Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialAdrian Diaz
3,500 PointsWhy 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
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
Treehouse TeacherHi 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 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!