Hack Forums
[Python] My Code wont run tetris properly? - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [Python] My Code wont run tetris properly? (/showthread.php?tid=5617716)



My Code wont run tetris properly? - KK123 - May 7, 2017

Can anyone help me with this, its due tomorrow. I've been working on it all day, or at least give me a hint whats wrong with it please!

https://pastebin.com/25dquBga


* - Appendix - May 9, 2017

I didn't know Python could get so intense. I'm also learning it


* - SIM-574702 - May 9, 2017

I'm busy but posting to check it later. From fast skim I've noticed
Code
fallingPiece = nextPiece
nextPiece = getNewPiece()

Are you sure this is in good order


* - Chercher - May 13, 2017

not going to bother to note the obvious wrongs here and the amount of autism in the beginning part because i'm sure you had a fun time writing it.

[looks at rest of code]

no im sure you've totally debugged the rest of this shit, the fact you couldn't even add syntax highlighting makes me squirt vomit.

ill just paste the obviously stupid shit

Code
newPiece = {'shape': shape,
                'rotation': random.randint(0, len(PIECES[shape]) - 1),
                'x': int(BOARDWIDTH / 2) - int(TEMPLATEWIDTH / 2),
                'y': -2, # start it above the board (i.e. less than 0)
                'color': random.randint(0, len(COLORS)-1)}
                              
    return newPiece

Code
if PIECES[piece['shape']][piece['rotation']][y][x] != BLANK:
                board[x + piece['x']][y+ piece['y']] = [piece['color']]

Code
LIGHTCOLORS = (LIGHTBLUE, LIGHTGREEN, LIGHTRED, LIGHTYELLOW)

Code
BLANK="."

Code
from pygame.locals import *

look i like dynamic code as much as the next person but this is OvK af.

also the fact you're not even utilizing the BLANK variable in the templates = kek