但是在我赢了比赛之后,(我每次都有电脑打印号码)电脑不断地挑选号码,试图获得一个位置,即使没有剩下的了。我不知道该怎么做,非常感谢任何帮助。
if board[computer] != 'X' and board[computer] != 'O':
print computer
board[computer] = 'O'
else:
while board[computer] == 'O' or board[computer] == 'X':
computer = random.randint(0, 8)
print computer
if board[computer] != 'X' and board[computer] != 'O':
board[computer] = 'O'
break