所以我必须创建一个掷骰子游戏,考虑到作业的投注.到目前为止,我的代码的工作原理是骰子卷是正确的,其他的小花絮也是要求的.但是现在我不知道如何将每个游戏记录为玩家或计算机的输赢,以便将底池添加到赢家的钱中.我意识到我的代码是一半,没有完成,并没有按原样运行,但我真的需要一些人的帮助.谢谢,麻烦您了.以下是我的任务的更具体方向:
http://www.ics.uci.edu/~kay/courses/i42/hw/labA.html
import random
def craps():
print("Welcome to Sky Masterson's Craps Game")
handle_commands()
def handle_commands(): # Collection -> Collection (plus interaction)
""" Display menu to user, accept and process commands
"""
playerInitial = 500
compInitial = 500
MENU = "How much would you like to bet?: "
while True:
bet = float(input(MENU))
if bet <= playerInitial:
human_game()
elif bet > playerInitial:
print("Sorry, you can't bet more than you have")
def handle_commands2():
MENU2 = "Would you like to play again? (y …Run Code Online (Sandbox Code Playgroud) python ×1