我正在制作一个游戏,每个玩家每回合可以拿走1-3个筹码,而获得最后筹码的玩家将获胜。在要求玩家选择一定数量的筹码的部分,我收到一个错误说:
Traceback (most recent call last):
File "F:\DOwnloads\okay (1).py", line 56, in <module>
temp = input(int ("there are", chips,"chips. how many chips does player one want to take"))
TypeError: int() takes at most 2 arguments (3 given)
以下是代码:
chips = 21
MAXCHIPS= 3
MINCHIPS= 1
playerOne = " "
playerTwo = " "
score1 = 0
TIE = "it was a tie"
score2 = 0
INTRO = "do you know how to play takeaways? please enter either yes or no"
RULES = "you each take turns to remove 1-3 chips from a pileof 21. whoever takes the last chip from the pile wins the round"
while(True):
instructions=input(INTRO)
if ((instructions == "yes") or (instructions == "no")):
if (instructions == "no"):
print (RULES)
break
elif (instructions == "yes"):
break
while( True ):
temp=input("what is player ones name? please enter a one word name")
if (temp.isalpha()) :
temp=playerOne
break
while( True ):
temp=input("what is player twos name? please enter a one word name")
if (temp.isalpha()) :
temp=playerTwo
break
while( True ):
game = input("How many gammes do you want to play?")
if( game.isdigit() ):
game = int(game)
if( game > 0 )and (game < 10):
break
while( True):
chips = int(chips)
temp = input(int ("there are", chips,"chips. how many chips does player one want to take"))
if (temp.isdigit() ):
temp = int(temp)
chips=-temp
break