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 GodMode-On
def checkio(game_result):
new_grid_cols = []
for i in range(3):
col = ""
for j in range(3):
col += game_result[j][i]
new_grid_cols.append(col)
diag = game_result[0][0] + game_result[1][1] + game_result[2][2]
diag_rewerse = game_result[0][2] + game_result[1][1] + game_result[2][0]
grid_check = game_result[:]
for i in new_grid_cols:
grid_check.append(i)
grid_check.append(diag)
grid_check.append(diag_rewerse)
if "XXX" in grid_check:
return "X"
elif "OOO" in grid_check:
return "O"
else:
return "D"
Jan. 12, 2015