1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
|
def (moves): for m in range(0, 3): if moves[0][m] == moves[1][m] == moves[2][m] == "X": return "'X' wins (vertical)." if moves[0][m] == moves[1][m] == moves[2][m] == "O": return "'O' wins (vertical)." for result in moves: if result == ("X", "X", "X"): return "'X' wins (horizontal)." if result == ("O", "O", "O"): return "'O' wins (horizontal)." if moves[0][0] == moves[1][1] == moves[2][2] == "X" or moves[2][0] == moves[1][1] == moves[0][2] == "X": return "'X' wins (diagonal)." if moves[0][0] == moves[1][1] == moves[2][2] == "O" or moves[2][0] == moves[1][1] == moves[0][2] == "O": return "'O' wins (diagonal)." return 'Draw.'
|
近期评论