the main(function handles creating some more global constants and showing the start screen that appears when the program is run while truegame loop if random randint( = pygame mixer music load('tetrisb mid'elsepygame mixer music load('tetrisc mid'pygame mixer music play(- rungame(pygame mixer music stop(showtextscreen('game over'the code for the actual game is all in rungame(the main(function here simply randomly decides what background music to start playing (either the tetrisb mid or tetrisc mid midi music file)then calls rungame(to begin the game when the player losesrungame(will return to main()which then stops the background music and displays the game over screen when the player presses keythe showtextscreen(function that displays the game over screen will return the game loop will loop back to the beginning at line and start another game the start of new game def rungame() setup variables for the start of the game board getblankboard( lastmovedowntime time time( lastmovesidewaystime time time( lastfalltime time time( movingdown false notethere is no movingup variable movingleft false movingright false score levelfallfreq calculatelevelandfallfreq(score fallingpiece getnewpiece( nextpiece getnewpiece(before the game begins and pieces start fallingwe need to initialize some variables to their startof-game values on line the fallingpiece variable will be set to the currently falling piece that can be rotated by the player on line the nextpiece variable will be set to the piece that shows up in the --next|part of the screen so that player knows what piece is coming up after setting the falling piece