猫史档案馆


[开源]橙软扫雷项目进度报告(α0.2)

用户:CoderorangesoftCoderorangesoft查看:1 回复:1 评论:1 创建时间:2022-05-21T14:24:09


import time
import random
import pgzrun
import os
'''
1.时间库
2.随机数库
3.pygame库
4.系统库
'''
# 导入库

print('______________________________________________________')
print('扫雷 版本α0.2 橙软制作')
print('______________________________________________________')
# 初始界面

print('''<公告>扫雷α 0.2 更新日志:
1.新增调试
2.雷区初始化
''')
print('<程序>启动中,请稍候...')
blocks = [[0, 0, 0, 0, 0, 0, 0, 0, 0], [
    0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0], [0, 0, 0, 0, 0, 0, 0, 0, 0]]
for i in range(9):
    defaultSweep = random.randint(0, 8)
    blocks[i][defaultSweep] = 1
while True:
    sweep = random.randint(0, 8)
    sweepI = random.randint(0, 8)
    if blocks[sweepI][sweep] == 1:
        continue
    else:
        blocks[sweepI][sweep] = 1
        break

print('<程序>启动完成!')
# 初始化雷区

HEIGHT = 500
WIDTH = 500
# 窗口绘制

back = Actor('back')
# 绘制角色


def draw():
    screen.blit('back', [0, 0])


pgzrun.go()

#调试驱动
def debug1():
    Debug_sweepCount = 0
    for Debug1_blocksMiner in blocks:
        for Debug1_blocksMiner1 in Debug1_blocksMiner:
            if Debug1_blocksMiner1 == 1:
                Debug_sweepCount += 1
    print('<调试>:blocks:')
    print('<调试>:',blocks)
    print('<调试>:blocks共有',len(blocks),'项,其中有',Debug_sweepCount,'项的值是‘1’')

# 调试
# 选择你想调试的内容,然后删去‘#’,即可启用该内容。
'''↓调试功能1:查看雷分布的位置(blocks列表)'''
#debug1()


回复

上一页1 页 / 共 1下一页
水翎稞水翎稞

我也有一个扫雷 https://shequ.cod喵/community/405420

点赞1


评论