免费图标下载网站,cms免费建站系统,wordpress统计分析,湘潭网站公司掷骰子游戏#xff1a;
掷骰子游戏
可选择的参加游戏的角色是#xff1a;1.貂蝉 2.刘备 3.孙悟空 4.诸葛亮 5.曹操
输入参加游戏的角色是: 1
貂蝉进入游戏……
貂蝉请充值#xff08;金额必须是100的倍数#xff09;#xff1a; ---》注意#xff1a;充值3次不…
掷骰子游戏
掷骰子游戏
可选择的参加游戏的角色是1.貂蝉 2.刘备 3.孙悟空 4.诸葛亮 5.曹操
输入参加游戏的角色是: 1
貂蝉进入游戏……
貂蝉请充值金额必须是100的倍数 ---》注意充值3次不成功退出游戏----》注意 如果充值成功
充值成功的金额是: 1000元 貂蝉请下注(必须是50的倍数不能大于充值金额) ---》可以反复下注
下注金额是100
# 注意是两个骰子 猜大 小 大两个骰子的和大于6或者两个骰子相同否则为小系统产生两个1-6之间的随机数作为骰子的个数
貂蝉猜大小大
如果猜对了则下注金额翻倍加到总金额中猜错了则总金额减去下注金额 询问是否下一轮游戏 --注意 可以继续下一轮游戏仍然从下注开始 import random
import timedef start_game():开始猜大小的游戏print(欢迎进入掷骰子游戏游戏)your_name input(输入玩家姓名: )names [刘备, 张飞,貂蝉]if your_name in names:print(玩家{}进入游戏.format(your_name))else:print(Invalid input!)current_money 0 # 币print(You have ${} now.请充钱.format(current_money))time.sleep(1)current_money int(input(请输入充值金额金额必须是100的倍数)) # 冲钱a 0while a 3:if current_money % 100 0:print(充值成功You have ${} now..format(current_money))breakelse:print(充值必须是100的倍数充值不成功请再次充值)a 1continueshaiz1 random.randint(0, 6)shaiz2 random.randint(0, 6)shaiz shaiz1 shaiz2 # 筛子数字总和print(shaiz)while current_money 0:print( Game Starts! )put_money int(input(请输入下注金额(必须是50的倍数不能大于充值金额)))if put_money % 50 ! 0 and put_money current_money:continueelse:print(You have ${} now..format(current_money))your_choice input(Big or Small: )choices [Big, Small]if your_choice in choices:passelse:print(Invalid input!)if your_choice Big:if shaiz 6:print(答对了哦)current_money put_money * 2print(You have ${} now..format(current_money))play_again input(是否继续--yes/no:)if play_again yes:continueelif play_again no:breakelse:print(错了哦)current_money - put_moneyprint(You have ${} now..format(current_money))play_again input(是否继续--yes/no:)if play_again yes:continueelif play_again no:breakif your_choice Small:if shaiz 6:print(答对了哦)current_money put_money * 2print(You have ${} now..format(current_money))play_again input(是否继续--yes/no:)if play_again yes:continueelif play_again no:breakelse:print(错了哦)current_money - put_moneyprint(You have ${} now..format(current_money))play_again input(是否继续--yes/no:)if play_again yes:continueelif play_again no:breakelse:print(Game Over!)print(欢迎再来玩掷骰子游戏游戏)if __name__ __main__:start_game()