Skip to main content
Engineering LibreTexts

8.4: The Usual Setup Code

  • Page ID
    13607
  • # Tetromino (a Tetris clone)
    # By Al Sweigart al@inventwithpython.com
    # http://inventwithpython.com/pygame
    # Released under a "Simplified BSD" license
    
    import random, time, pygame, sys
    from pygame.locals import *
    
    FPS = 25
    WINDOWWIDTH = 640
    WINDOWHEIGHT = 480
    BOXSIZE = 20
    BOARDWIDTH = 10
    BOARDHEIGHT = 20
    BLANK = '.'
    

    These are the constants used by our Tetromino game. Each box is a square that is 20 pixels wide and high. The board itself is 10 boxes wide and 20 boxes tall. The BLANK constant will be used as a value to represent blank spaces in the board’s data structure.