game_result = [
u"OOX",
u"XXO",
u"OXX"]
>>> def check_win(game_result):
# Column and row checking>>> for i in range(3):
>>> if game_result[i][0] ==
game_result[i][1] ==
game_result[i][2]:
>>> return game_result[i][0]
>>> if game_result[0][i] ==
>>> if game_result[0][i] ==
game_result[1][i] ==
game_result[2][i]:
>>> return game_result[0][i]
# Diagonal checking
>>> if game_result[0][0] ==
# Diagonal checking
>>> if game_result[0][0] ==
game_result[1][1] ==
game_result[2][2]:
>>> return game_result[1][1]
>>> if game_result[2][0] ==
>>> if game_result[2][0] ==
game_result[1][1] ==
game_result[0][2]:
>>> return game_result[1][1]
>>> return "D"
>>> return "D"
Комментариев нет:
Отправить комментарий