Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Opus magnum solution in Clear category for Xs and Os Referee by virzen
WINNING_SEQUENCES = [
[(0, 0), (0, 1), (0, 2)],
[(1, 0), (1, 1), (1, 2)],
[(2, 0), (2, 1), (2, 2)],
[(0, 0), (1, 0), (2, 0)],
[(0, 1), (1, 1), (2, 1)],
[(0, 2), (1, 2), (2, 2)],
[(0, 0), (1, 1), (2, 2)],
[(0, 2), (1, 1), (2, 0)],
]
def allEqual(list):
return list[1:] == list[:-1]
def checkio(game_result):
for points in WINNING_SEQUENCES:
results = [game_result[x][y] for x, y in points]
if allEqual(results) and results[0] != '.':
return results[0]
return 'D'
Jan. 8, 2017