当前位置: 移动技术网 > 互联网>游戏>手游 > zizhan - 猜拳小游戏

zizhan - 猜拳小游戏

2020年08月10日  | 移动技术网互联网  | 我要评论
"""

石头1 布2  剪刀3
赢
我们   电脑  结果
1       3    -2
2       1     1
3       2     1
"""
import random

# 我们出拳
a = int(input('''请出拳
石头是1,布是2,剪刀是3'''))

# 电脑出拳
b = random.randint(1, 3)
# 判断胜负
if a==1 or a==2 or a==3:
    result = a - b
    if result == -2 or result == 1:
        print('胜利')
    elif result == 0:
        print('平局')
    else:
        print('失败')
    if a==1:
        print('玩家:石头')
    elif a==2:
        print('玩家:布')
    else:
        print('玩家:剪刀')
    if b==1:
        print('电脑:石头')
    elif b==2:
        print('电脑:布')
    else:
        print('电脑:剪刀')
else:
    print('请认真游戏')

import random
import turtle as t
size_x  = 5
size_big = 20


t.speed(0)
# rgb
t.colormode(255)
color = (random.randint(0,255),random.randint(0,255),random.randint(0,255))
t.color(color,color)
t.bgcolor('black')
t.begin_fill()
a= random.randint(size_x ,size_big)
b= 144
t.fd(a)
t.lt(b)
t.fd(a)
t.lt(b)
t.fd(a)
t.lt(b)
t.fd(a)
t.lt(b)
t.fd(a)
t.lt(b)
t.end_fill()

t.up()
t.goto(random.randint(0,500),random.randint(0,500))
t.down()

本文地址:https://blog.csdn.net/houlaos/article/details/107860461

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网