I just completed a program that should (hopefully) play a GUI Tetris program. I’ve cleaned up all the syntax errors, but now when I double-click, or go through the Command Prompt to run the program a DOS window pops up for less than a second and disappears without ever running the program.
What’s going on?
Heres a link to the code at codepad.org
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 (indiff‘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.Boarddinstead ofBoard,eveninstead ofevent),rnageinstead ofrange, and so on, and so forth.After all these fixes, I’ve stopped upon spotting one more typo (you
def sqaureHeightwhen you clearly meansquareHeight) — 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
pylintmay also help a little, although they do have limits.Edit: as it turns out, after fixing a couple of occurences of
sqaureintosquare, the program does run — and immediately shows an empty window saying “Game Over” and gets to theraw_inputprompt 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.