Commit 8d7365d6 by BellCodeEditor

auto save

parent c66a449e
Showing with 22 additions and 22 deletions
# 利用write()帮助悟空给诺依回信吧~ #玩家出拳
import turtle player=input("玩家请出拳")
screen=turtle.Screen() print("玩家出拳:"+player)
screen.bgcolor("light blue") #计算机出拳
len=screen.textinput("100","100") import random
len=int(len) list=["石头","剪刀","布"]
pen=turtle.Pen() computer=random.choice(list)
pen.write("你好\nSB.",font=("Times",30,"normal")) print("计算机出拳:"+computer)
pen.hideturtle() #显示结果
len=60 if player in list:
pen.penup() if player==computer:
pen.goto(100,100) print("平局")
pen.pendown() elif player=="石头" and computer=="剪刀":
pen.pensize(5) print("恭喜,你赢了")
pen.pencolor("red") elif player=="剪刀" and computer=="布":
pen.left(45) print("恭喜,你赢了")
pen.forward(2*len) elif player=="布" and computer=="石头":
pen.circle(len,180) print("恭喜,你赢了")
pen.right(90) else:
pen.circle(len,180) print("很遗憾,你输了")
pen.forward(2*len) else:
turtle.done() print("输入错误")
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