Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Xs and Os Referee by tokyoamado
def checkio(game_result):
columns = [''.join(x) for x in zip(*game_result)]
diagonals = [''.join(x) for x in [
[game_result[i][i] for i in [0, 1, 2]],
[game_result[i][2 - i] for i in [0, 1, 2]]
]]
lines = game_result + columns + diagonals
if 'OOO' in lines:
return 'O'
elif 'XXX' in lines:
return 'X'
else:
return 'D'
Sept. 15, 2017