用户:友善的小黄鸡_漂流龙查看:0 回复:0 评论:0 创建时间:2021-05-24T22:51:05
【作品展示】

【作品介绍】
h哈哈
【作品源代码】
import turtle,random
P = turtle.Pen()
P.penup()
P.speed(0)
P.pencolor('yellow')
P.hideturtle()
P.goto((-400), 400)
P.begin_fill()
for i in range(4):
P.forward(800)
P.right(90)
P.end_fill()
for i in range(9):
P.goto((-400), (400 - (800 / 8) * i))
P.pendown()
P.forward(800)
P.penup()
P.right(90)
for i in range(9):
P.goto((-400 + (800 / 8) * i), 400)
P.pendown()
P.forward(800)
P.penup()
P.pencolor('black')
for i in range(8):
P.goto(((-400 + 800 / 16) + (800 / 8) * i), 390)
number = (i + 1)
P.write(number, font=("Arial", 30))
for i in range(8):
P.goto((-450), ((400 - 800 / 9) - (800 / 8) * i))
number = (i + 1)
P.write(number, font=("Arial", 30))
P.pencolor('black')
P.goto(-600, 100)
P.write("剩余生命:", font=("Anna", 20))
P.goto(-475, 100)
P.write("3", font=("Anna", 20))
P.pencolor('white')
HP = 3
L = 0
weizhi = []
lei = []
zong = {}
for i in range(喵):
lei.append(random.randint(1, 4))
lei[random.randint(0, 63)] = 0
for i in range(8):
for a in range(8):
weizhi.append(((i + 1) * 10 + (a + 1)))
zong[str(((i + 1) * 10 + (a + 1)))] = lei[(i * 8 + a)]
P.pencolor('white')
P.fillcolor('red')
x_ = turtle.Screen()
x = int(turtle.textinput('扫雷', '请输入横向:'))
y_ = turtle.Screen()
y = int(turtle.textinput('扫雷', '请输入纵向:'))
while (zong[str((x * 10 + y))] == 1 or zong[str((x * 10 + y))] == 2 or zong[str((x * 10 + y))] == 3 or zong[str((x * 10 + y))] == 4):
if (zong[str((x * 10 + y))] == 1):
P.penup()
P.goto((-400 + x * 100), (400 - (y - 1) * 100))
P.begin_fill()
for i in range(4):
P.forward(100)
P.right(90)
P.end_fill()
HP = HP-1
P.pencolor('black')
P.goto(-600, 100-(3-HP)*50)
P.write("剩余生命:", font=("Anna", 20))
P.goto(-475, 100-(3-HP)*50)
P.write(HP, font=("Anna", 20))
P.pencolor('white')
if HP == 0:
P.goto(-200, -50)
P.write("你输了", font=("Anna", 100))
turtle.down()
else:
try:
if (zong[str(((x * 10 + y) + 1))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) - 1))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) + 10))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) - 10))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) - 9))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) + 9))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) + 11))] == 1):
L = (L + 1)
except:
print(" ")
try:
if (zong[str(((x * 10 + y) - 11))] == 1):
L = (L + 1)
except:
print(" ")
P.penup()
P.goto(((-400 + x * 100) - 60), ((400 - y * 100) + 25))
P.write(L, font=("Arial", 40))
L = 0
x_ = turtle.Screen()
x = int(turtle.textinput('扫雷', '请输入横向:'))
y_ = turtle.Screen()
y = int(turtle.textinput('扫雷', '请输入纵向:'))
P.goto(-200, -50)
P.write("你赢了", font=("Anna", 100))
turtle.done()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn