所以我正在研究这个X和O的游戏,在测试时我遇到了这个错误,我不知道为什么或者如何修复它。当我触发intro函数并且用户必须选择那里的模式时,就会发生这种情况。在
####PROGRAM IMPORTS BELOW####
import time
import random
####PROGRAM CLASSES####
####PROGRAM FUNCTIONS BELOW####
def choosemode():
desiredmode = int(input("PLEASE ENTER 1 OR 2 TO PLAY" , '\n' , "OR 3 FOR HTP" , '\n' ))
if desiredmode == 1 :
onep()
elif desiredmode == 2 :
twop()
elif desiredmode == 3 :
HTP()
else :
choosemode()
def gamemodes():
gm1 , gm2 , gm3 = (" 1 PLAYER" , " 2 PLAYER" , " HOW TO PLAY")
print ( '\n' , gm1 , '\n' , gm2 , '\n' , gm3 , '\n' )
return
def boardformat():
print (" 0 | 1 | 2 ")
print ("-----------")
print (" 3 | 4 | 5 ")
print ("-----------")
print (" 6 | 7 | 8 ")
def boardatplay():
print ( b0, "|" ,b1, "|" ,b2 )
print ("--------------------")
print ( b3, "|" ,b4, "|" ,b5 )
print ("--------------------")
print ( b6, "|" ,b7, "|" ,b8 )
def restartboard():
b0 = b1 = b2 = b3 = b4 = b5 = b6 = b7 = b8 = (" ")
def checkforwinx():
if b0 & b1 & b2 == "X" or b3 & b4 & b5 == "X" or b6 & b7 & b8 == "X" or b0 & b3 & b6 == "X" or b1 & b4 & b7 == "X" or b2 & b5 & b8 == "X" or b0 & b4 & b8 == "X" or b2 & b4 & b6 == "X" :
print ("X WINS!")
def checkforwino():
if b0 & b1 & b2 == "O" or b3 & b4 & b5 == "O" or b6 & b7 & b8 == "O" or b0 & b3 & b6 == "O" or b1 & b4 & b7 == "O" or b2 & b5 & b8 == "O" or b0 & b4 & b8 == "O" or b2 & b4 & b6 == "O" :
print ("O WINS!")
def intro():
print ("WELCOME TO X and O's PYTHON EDITION!", '\n' ,"WHAT WOULD YOU LIKE TO PLAY?")
gamemodes()
choosemode()
def onep():
print ( "ONE PLAYER SELECTED!" )
print ( "PLEASE ENTER YOUR NAME" )
name1 = input()
print ( name1 , "VS COMPUTER" )
print ( "PRESS ENTER WHEN READY!")
input()
def twop():
print ( "TWO PLAYER SELECTED!" )
def HTP():
print( "1) To plot a point type the number of the area you want plot in" )
boardformat()
print( "2) " )
####PROGRAM BEGINS BELOW####
restartboard()
print ( "LOADING..." )
time.sleep(4)
print ( "READY!" )
time.sleep(2)
print ( "A EUAN DEAS PRODUCTION" + '\n' )
time.sleep(2)
intro()
我得到了一个错误:
^{pr2}$
给四个字符串作为输入参数。把他们连在一起
相关问题 更多 >
编程相关推荐