From 12df2721cf27e8b44234892cce97976f4e93ff40 Mon Sep 17 00:00:00 2001
From: BellCodeEditor <bellcode_dev@bell.ai>
Date: Sun, 12 Jun 2022 14:19:27 +0800
Subject: [PATCH] save project

---
 my_Tetris.py | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/my_Tetris.py b/my_Tetris.py
index 8711234..38a749c 100644
--- a/my_Tetris.py
+++ b/my_Tetris.py
@@ -1,6 +1,6 @@
 import pygame
 from pygame import locals
-
+import random
 pygame.init()   # 初始化
 score = 0
 grid_size = 20  # 格子大小
@@ -44,8 +44,11 @@ cube_colors = [
     (255, 204, 0), (204, 0, 51),(255, 0, 51), (0, 102, 153),
     (153, 0, 51), (204, 255, 102), (255, 153, 0)]
 
-center = [2, 8]     # 第2行第8列
-current_shape = [(0, -1), (0, 0), (0, 1), (-1, 0)]
+center = [2, 8]
+s=random.choice(shape_list)
+index=random.randint(0,len(s)-1)     # 第2行第8列
+current_shape = s[index]
+color=random.choice(cube_colors)
 
 while True:
     for event in pygame.event.get():
@@ -73,7 +76,7 @@ while True:
     for cube in current_pos:
         pygame.draw.rect(screen, color,
                     (cube[1] * 20-20, cube[0] * 20-20, 20, 20), 0)
-        pygame.draw.rect(screen, (255, 255, 255), 
+        pygame.draw.rect(screen, (255,255,255),
                         (cube[1] * 20-20, cube[0] * 20-20, 20, 20), 1)
     # 得分
     text_surface = font.render(str(score), True, (0, 0, 0))
--
libgit2 0.25.0