Python Object-Oriented Python Dice Roller Boards

Adrian Diaz
Adrian Diaz
2,742 Points

Why do i keep getting bummer try again and im not being told the error?

I don't understand anything this guy has been teaching after every video I have to go on YouTube to try and get a better understanding. I'm not sure why this code isn't working.

I believe the call of the super method should be working but i keep getting bummer try again. I dont know whats wrong

boards.py
class Board:
    def __init__(self, width, height):
        self.width = width
        self.height = height
        self.cells = []
        for y in range(self.height):
            for x in range(self.width):
                self.cells.append((x, y))
class TicTacToe(Board):
    def __init__(self, width, height):
        super().__init__(self.width=3, self.height=3)

1 Answer

Jennifer Nordell
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Jennifer Nordell
Treehouse Staff

Hi there, Adrian Diaz! The reason it can't tell you anything else is that you have some syntax errors. On the TicTacToe class, self.width and self.height aren't defined and you're trying to send them in as arguments to the __init__ of the Board class.

Let's back up for a minute. First, the TicTacToe does not need to accept a width nor a height. A traditional Tic tac toe game is 9 squares. Three high and three wide. There's never going to be an instance where we create a 7 by 30 tic tac toe game, for example. It wouldn't be tic tac toe then :smiley: Just like I would always expect a ChessGame to always be 64 squares. 8 x 8.

class TicTacToe(Board):
    def __init__(self):
        super().__init__(3, 3)

This says make a new class TicTacToe. Call the super() for the parent which is Board and hand it 3 for the width and 3 for the height. Because that will always be the dimensions for a Tic tac toe game.

Hope this helps! :sparkles: