Commit d060187c by BellCodeEditor

auto save

parent 8c30006e
Showing with 16 additions and 0 deletions
......@@ -127,6 +127,22 @@ while True:
(j * 20-20, i * 20-20, 20, 20), 0)
pygame.draw.rect(screen, (255, 255, 255),
(j* 20-20, i* 20-20, 20, 20), 1)#在该位置画出小方块
#创建一个新的列表new_list
new_list=[]
for i in range(25):
new_list.append([0]*15)
row_index=24 #定义变量row_index,表示列表的行数
for i in range(24,-1,-1): #生成一个24→0的序列,实现从下往上对列表进行遍历
is_full=True #设置is_full变量,记录满行情况
for j in range(15): #对该行网格进行遍历
if num_list[i][j]==0: #如果该行有网格的数据为0
is_full=False #is_full的值设置为false
if is_full==False:
new_list[row_index] = num_list[i] #把该行的数据增加到新的列表中
row_index-=1#列表剩余行数减一
else: #否则
score+=1 分数加1
num_list=new_list
# 得分
text_surface = font.render(str(score), True, (0, 0, 0))
screen.blit(text_surface, (350,70))
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment