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 newdogcs
def checkio(game_result):
# check horizontal
for row in game_result:
if row[0] == row[1] == row[2] != '.':
return row[0]
# check vertical
for column in range(3):
if game_result[0][column] == game_result[1][column] == game_result[2][column] != '.':
return game_result[0][column]
# check diagonals
if game_result[0][0] == game_result[1][1] == game_result[2][2] != '.':
return game_result[0][0]
if game_result[0][2] == game_result[1][1] == game_result[2][0] != '.':
return game_result[0][2]
# draw
else: return 'D'
July 4, 2014