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 xavierskip
def checkio(game_result):
r = game_result
r += [''.join(x) for x in zip(*game_result)]
r += [game_result[0][0]+game_result[1][1]+game_result[2][2],
game_result[0][2]+game_result[1][1]+game_result[2][0]]
o = r.count('OOO')
x = r.count('XXX')
if o and x:
return "D"
elif o:
return "O"
elif x:
return "X"
else:
return "D"
#These "asserts" using only for self-checking and not necessary for auto-testing
May 23, 2014