Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
Clear and Simple solution in Clear category for Xs and Os Referee by metal4people
def checkio(game_result):
win_positions = (
((0,0), (0,1), (0,2)), ((1,0), (1,1), (1,2)), ((2,0), (2,1), (2,2)), #horizontal
((0,0), (1,0), (2,0)), ((0,1), (1,1), (2,1)), ((0,2), (1,2), (2,2)), #vertical
((0,0), (1,1), (2,2)), ((2,0), (1,1), (0,2)) #diagonal
)
result = "D"
for row in win_positions:
if all(game_result[p[0]][p[1]] == 'X' for p in row):
result = "X"
elif all(game_result[p[0]][p[1]] == 'O' for p in row):
result = "O"
return result
March 12, 2015