由python编写的三子棋游戏
#main program begins here
while True:
i=0
while (i<3):
print(mark[board[i * 3]],mark[board[i * 3 1]], mark[board[i * 3 2]])
i =1
if checkcircle():
print("Player1 wins!")
break
elif checkcross():
print("Player2 wins!")
break
elif checkfull():
print("It's a draw.")
break
while True:
while True:
y =int(input("line:"))
if 1 <= y <= 3:
break
else:
print("The inputshould between 1 and 3")
while True:
x =int(input("column:"))
if 1 <= x <= 3:
break
else:
print("The inputshould between 1 and 3")
if board[y*3-4 x] == 1 orboard[y*3-4 x] == 2:
print("No place at thisposition.")
else:
break
if j > 1:
j = 0
if j == 0:
circlebd(y, x)
elif j == 1:
crossbd(y, x)
j =1
评论