day2 craps赌博游戏

说明:CRAPS又称花旗骰,是美国拉斯维加斯非常受欢迎的一种的桌上赌博游戏。该游戏使用两粒骰子,玩家通过摇两粒骰子获得点数进行游戏。简单的规则是:玩家第一次摇骰子如果摇出了7点或11点,玩家胜;玩家第一次如果摇出2点、3点或12点,庄家胜;其他点数玩家继续摇骰子,如果玩家摇出了7点,庄家胜;如果玩家摇出了第一次摇的点数,玩家胜;其他点数,玩家继续要骰子,直到分出胜负。

from random import randint

money = 1000
while money > 0:
    print('你的总资产为',money)
    needs_go_on = False
    while True:
        debt = int(input('你的下注是'))
        if 0 < debt <= money:
            break
    first = randint(1,6) + randint(1,6)
    print('玩家扔出了%d' % first)
    
    if first == 7 or first == 11:
        print('玩家胜')
        money += debt
    
    elif first == 2 or first == 3 or first == 12:
        print('庄家胜出')
        money -= debt

    else:
        needs_go_on = True
    
    while needs_go_on:
        needs_go_on = False
        current = randint(1,6)+randint(1,6)
        print('玩家扔出了%d' % current)
        
        if current == 7 or current == 11:
            print('玩家胜')
            money += debt

        elif current == 2 or current == 3 or current == 12:
            print('庄家胜出')

        else:
            needs_go_on = True
print('你妈死了') 

今天的几个失误
1.False和Ture都是首字母大写
2.=号和==号又搞错了
3.%d和%到底什么意思,艹!

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值