zizhan - 猜拳小游戏

"""

石头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()
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值