Wow, there's really a huge number of errors in your code. I started running it under pdb
, identifying and fixing them one by one, but after 20 or so I gave up. What I fixed so far (in diff
's output, lines start with <
to mean they're in your version, or with >
to mean they're in my partially fixed version). Note the variety: you often write Flase instead of False, use wrong capitalization, use -
(minus) instead of =
(equals), misspell variables (e.g. Boardd
instead of Board
, even
instead of event
), rnage
instead of range
, and so on, and so forth.
37c37
< self.isStarted = Flase
---
> self.isStarted = False
63c63
< self.isWaitingAfterLine - Flase
---
> self.isWaitingAfterLine = False
87c87
< for i in range(Board.BoardHeight * Board.Boardwidth):
---
> for i in range(Board.BoardHeight * Board.BoardWidth):
135c135
< if even.GetId() == Boardd.ID_TIMER:
---
> if event.GetId() == Board.ID_TIMER:
205c205
< self.curY = Board.Height - 1 + self.curPiece.minY()
---
> self.curY = Board.BoardHeight - 1 + self.curPiece.minY()
214c214
< for i in rnage(4):
---
> for i in range(4):
217c217
< if x < 0 or x >= Board.BoardWidth or y < 0 or y >= Board.Boardheight:
---
> if x < 0 or x >= Board.BoardWidth or y < 0 or y >= Board.BoardHeight:
278c278
< self.coords = [[0, 0] for i in rnage(4)]
---
> self.coords = [[0, 0] for i in range(4)]
356c356,357
< Tetris(None, -1, 'Tetris')
---
> tetris = Tetris(None, -1, 'Tetris')
> app.SetTopWindow(tetris)
After all these fixes, I've stopped upon spotting one more typo (you def sqaureHeight
when you clearly mean squareHeight
) -- I have no idea how many typos and other mistakes are still hiding in these 360 lines of code... A density of more such bugs than 1/10th of the lines is plenty high enough for me.
I heartily recommend that you start with much less ambitious projects and teach yourself to carefully "copyedit" your code for these typos you appear to be so prone to: it's possible to be dyslexic and an excellent programmer at the same time, but it does take extra effort and diligence on your part. Tools such as pylint
may also help a little, although they do have limits.
Edit: as it turns out, after fixing a couple of occurences of sqaure
into square
, the program does run -- and immediately shows an empty window saying "Game Over" and gets to the raw_input
prompt you have as your very last line. So beyond the many typos there must be one or more nasty logic-level bugs as well. I repeat the entreaty to start with something much, much simpler in your first forays into programming.