【发布时间】:2017-11-30 14:05:21
【问题描述】:
我最近开始使用 python 3.0,并且一直在编写 Hazard 赌场游戏,并且我使用这样的 if 语句:
def starthazard():
global chips
Main = input ("Main")
time.sleep(0.1)
if Main == "?" :
print(" Hazard Rules... ")
time.sleep(0.5)
print("You can main 6,7,8 or 9. The main your luckiest number")
time.sleep(0.5)
print("Nicks is winning either 3 / 1 if main is rolled but 1 / 2 if chance is rolled.")
print("Rolling your main is nicks")
print("2 or 3 is thrown out")
time.sleep(0.5)
print("with a main of 5 or 9, you throw out with both an 11 and a 12")
print("with a main of 6 or 8, you throw out with an 11 but nick with a 12")
print("with a main of 7, you nick with an 11 but throw out with a 12")
print("Other numbers are Chance, Roll again but this time main is out and Chance is nicks")
time.sleep(6.9)
Main = input ("Main")
Bet = input("you have " + str (chips) + " chips, what bet would you like to
place?")
dice1HAZARD = random.randint(1,6)
dice2HAZARD = random.randint(1,6)
RESULTHAZARD = dice2HAZARD + dice1HAZARD
print("first dice is... " + str (dice1HAZARD))
time.sleep(1)
print("second dice is " + str (dice2HAZARD))
time.sleep(1)
print("therefore your number is "+ str (RESULTHAZARD))
time.sleep(1)
if RESULTHAZARD == 2 or 3 :
print("THROWN OUT! MINUS " + Bet + " Chips" )
chips = chips - int (Bet)
PLAYAGAIN = input("play again? Y/N")
if PLAYAGAIN == "Y":
starthazard()
else:
PICKGAME()
if RESULTHAZARD == Main :
print("NICKS 3/1!")
CHIPSWON = Bet * 3
chips = chips + CHIPSWON
PLAYAGAIN = input("play again? Y/N")
if PLAYAGAIN == "Y":
starthazard()
else:
starthazard()
def CHANCECHECK():
if RESULTHAZARD != Main or 2 or 3 or 11 or 12:
print("CHANCE" + str (RESULTHAZARD) )
dice1HAZARD = random.randint(1,6)
dice2HAZARD = random.randint(1,6)
RESULTHAZARD = dice2HAZARD + dice1HAZARD
print("first dice is... " + str (dice1HAZARD))
time.sleep(1)
print("second dice is " + str (dice2HAZARD))
time.sleep(1)
print("therefore your number is "+ str (RESULTHAZARD))
time.sleep(1)
CHANCECHECK()
为什么返回 this : 主要7
你有 800 个筹码,你想下什么赌注? 10
第一个骰子是... 6
第二个骰子是 1
所以你的号码是 7
扔掉!减去 10 个筹码
再玩一次?是/否
【问题讨论】:
标签: python python-3.x