用户:依依76LY查看:0 回复:1 评论:0 创建时间:2020-08-23T16:44:44
【作品展示】

【作品介绍】
电脑版石头剪刀布!
【作品源代码】
import turtle
import easygui
import time
import random
import pygame
__Pen = turtle.Pen()
p = turtle.Pen()
t = turtle.Pen()
global computer, Choice, geass, color, s
AV = {'you': 0, 'AI': 0}
color = {'winner': 'yellow', 'gameover': 'gray'}
Choice = ['rock', 'sciserse', 'paper']
turtle.bgcolor('black')
easygui.msgbox('GAME REALY?', 'PRS', 'START')
p.pencolor('white')
def win():
AV['you'] = (AV['you'] + 1)
p.penup()
p.goto((0),(-100))
p.pendown()
p.write(AV['you']+':'+AI['AI'],font = ('Consolas',50,'normal'))
t.pencolor(color['winner'])
t.penup()
t.goto((-200), 0)
t.pendown()
t.write('GAMEWIN', font = ('Consolas', 72, 'normal'))
time.sleep(1)
t.clear()
def over():
AV['AI'] = (AV['AI'] + 1)
p.penup()
p.goto((0), (-100))
p.pendown()
p.write(AV['you']+':'+AI['AI'], font=('Consolas', 50, 'normal'))
t.pencolor(color['gameover'])
t.penup()
t.goto((-200), 0)
t.pendown()
t.write('GAMEOVER', font = ('Consolas', 72, 'normal'))
time.sleep(1)
t.clear()
def game():
geass = turtle.textinput('PRS', 'rock,paper or sciserse(or exit):')
computer = random.choice(Choice)
if (geass == computer):
easygui.msgbox('平局不算,重新开始!', 'PRS', 'OK')
game()
elif (geass == 'rock' and computer == 'sciserse' or geass == 'sciserse' and computer == 'paper' or geass == 'paper' and computer == 'rock'):
win()
easygui.msgbox(('YOU WIN!!! VERY GOOD!!!MY IS ' + computer), 'PRS', 'YEAH!!')
elif (computer == 'rock' and geass == 'sciserse' or computer == 'sciserse' and geass == 'paper' or computer == 'paper' and geass == 'rock'):
over()
easygui.msgbox(('Oh no! you OVER!MY IS ' + computer), 'PRS', 'Mmm(@^@)')
elif (geass == 'exit'):
EQ()
else:
easygui.msgbox('WORRG!!!', 'PRS', 'OK')
s = 0
while True:
game()
s += 1
if (s % 10 == 0):
easygui.msgbox('现比分:'+AV['you']+':'+AV['AI'],'PRS','THANK!')
if easygui.ynbox('exit GAME?', 'PRS', ('exit', 'agian')):
easygui.msgbox('最终比分:'+AV['you']+':'+AV['AI'],'PRS','FINISH->')
break
EQ()
def EQ():
print('感谢您游玩此次游戏,本游戏由陈骁工作室制作,您对此游戏打多少分?满分5分,暂不评分为0分')
pingfeng = int(input())
print('谢谢您的评分,我们会更加努力,再见!')
quit()
【提示】
部分含有Python第三方库相关内容的作品,在海龟编辑器网页端无法运行哦!如遇到这种情况,可以打开下面的链接,下载海龟编辑器客户端:
https://python.codemao.cn