document.write('
Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. import pygame
  2. import random
  3.  
  4. # creating the data structure for pieces
  5. # setting up global vars
  6. # functions
  7. # - create_grid
  8. # - draw_grid
  9. # - draw_window
  10. # - rotating shape in main
  11. # - setting up the main
  12.  
  13. """
  14. 10 x 20 square grid
  15. shapes: S, Z, I, O, J, L, T
  16. represented in order by 0 - 6
  17. """
  18.  
  19. pygame.font.init()
  20.  
  21. # GLOBALS VARS
  22. s_width = 800
  23. s_height = 700
  24. play_width = 300  # meaning 300 // 10 = 30 width per block
  25. play_height = 600  # meaning 600 // 20 = 20 height per block
  26. block_size = 30
  27.  
  28. top_left_x = (s_width - play_width) // 2
  29. top_left_y = s_height - play_height
  30.  
  31.  
  32. # SHAPE FORMATS
  33.  
  34. S = [[\'.....\',
  35.       \'......\',
  36.       \'..00..\',
  37.       \'.00...\',
  38.       \'.....\'],
  39.      [\'.....\',
  40.       \'..0..\',
  41.       \'..00.\',
  42.       \'...0.\',
  43.       \'.....\']]
  44.  
  45. Z = [[\'.....\',
  46.       \'.....\',
  47.       \'.00..\',
  48.       \'..00.\',
  49.       \'.....\'],
  50.      [\'.....\',
  51.       \'..0..\',
  52.       \'.00..\',
  53.       \'.0...\',
  54.       \'.....\']]
  55.  
  56. I = [[\'..0..\',
  57.       \'..0..\',
  58.       \'..0..\',
  59.       \'..0..\',
  60.       \'.....\'],
  61.      [\'.....\',
  62.       \'0000.\',
  63.       \'.....\',
  64.       \'.....\',
  65.       \'.....\']]
  66.  
  67. O = [[\'.....\',
  68.       \'.....\',
  69.       \'.00..\',
  70.       \'.00..\',
  71.       \'.....\']]
  72.  
  73. J = [[\'.....\',
  74.       \'.0...\',
  75.       \'.000.\',
  76.       \'.....\',
  77.       \'.....\'],
  78.      [\'.....\',
  79.       \'..00.\',
  80.       \'..0..\',
  81.       \'..0..\',
  82.       \'.....\'],
  83.      [\'.....\',
  84.       \'.....\',
  85.       \'.000.\',
  86.       \'...0.\',
  87.       \'.....\'],
  88.      [\'.....\',
  89.       \'..0..\',
  90.       \'..0..\',
  91.       \'.00..\',
  92.       \'.....\']]
  93.  
  94. L = [[\'.....\',
  95.       \'...0.\',
  96.       \'.000.\',
  97.       \'.....\',
  98.       \'.....\'],
  99.      [\'.....\',
  100.       \'..0..\',
  101.       \'..0..\',
  102.       \'..00.\',
  103.       \'.....\'],
  104.      [\'.....\',
  105.       \'.....\',
  106.       \'.000.\',
  107.       \'.0...\',
  108.       \'.....\'],
  109.      [\'.....\',
  110.       \'.00..\',
  111.       \'..0..\',
  112.       \'..0..\',
  113.       \'.....\']]
  114.  
  115. T = [[\'.....\',
  116.       \'..0..\',
  117.       \'.000.\',
  118.       \'.....\',
  119.       \'.....\'],
  120.      [\'.....\',
  121.       \'..0..\',
  122.       \'..00.\',
  123.       \'..0..\',
  124.       \'.....\'],
  125.      [\'.....\',
  126.       \'.....\',
  127.       \'.000.\',
  128.       \'..0..\',
  129.       \'.....\'],
  130.      [\'.....\',
  131.       \'..0..\',
  132.       \'.00..\',
  133.       \'..0..\',
  134.       \'.....\']]
  135.  
  136. shapes = [S, Z, I, O, J, L, T]
  137. shape_colors = [(0, 255, 0), (255, 0, 0), (0, 255, 255), (255, 255, 0), (255, 165, 0), (0, 0, 255), (128, 0, 128)]
  138. # index 0 - 6 represent shape
  139.  
  140.  
  141. class Piece(object):
  142.     pass
  143.  
  144. def create_grid(locked_positions={}):
  145.     pass
  146.  
  147. def convert_shape_format(shape):
  148.     pass
  149.  
  150. def valid_space(shape, grid):
  151.     pass
  152.  
  153. def check_lost(positions):
  154.     pass
  155.  
  156. def get_shape():
  157.     pass
  158.  
  159.  
  160. def draw_text_middle(text, size, color, surface):
  161.     pass
  162.    
  163. def draw_grid(surface, row, col):
  164.     pass
  165.  
  166. def clear_rows(grid, locked):
  167.  
  168.  
  169. def draw_next_shape(shape, surface):
  170.  
  171.  
  172. def draw_window(surface):
  173.     pass
  174.  
  175. def main():
  176.     pass
  177.  
  178. def main_menu():
  179.     pass
  180.  
  181. main_menu()  # start game
');