elif (event key =k_down or event key =k_s) movingdown true if isvalidposition(boardfallingpieceadjy= ) fallingpiece[' '+ lastmovedowntime time time( move the current block all the way down elif event key =k_space movingdown false movingleft false movingright false for in range( boardheight) if not isvalidposition(boardfallingpieceadjy= ) break fallingpiece[' '+ handle moving the block because of user input if (movingleft or movingrightand time time(lastmovesidewaystime movesidewaysfreq if movingleft and isvalidposition(boardfallingpieceadjx= ) fallingpiece[' '- elif movingright and isvalidposition(boardfallingpieceadjx= ) fallingpiece[' '+ lastmovesidewaystime time time( if movingdown and time time(lastmovedowntime movedownfreq and isvalidposition(boardfallingpieceadjy= ) fallingpiece[' '+ lastmovedowntime time time( let the piece fall if it is time to fall if time time(lastfalltime fallfreq see if the piece has landed if not isvalidposition(boardfallingpieceadjy= ) falling piece has landedset it on the board addtoboard(boardfallingpiece score +removecompletelines(board levelfallfreq calculatelevelandfallfreq(score fallingpiece none else piece did not landjust move the block down fallingpiece[' '+ lastfalltime time time(email questions to the authoral@inventwithpython com