Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in 3rd party category for Xs and Os Referee by DLCstvi4
import numpy as np
def checkio(game_result):
for i,v in enumerate(game_result):
game_result[i] = [int(i) for i in (v.replace('X', ' 1 ').replace('O', ' -1 ').replace('.', ' 0 ').split())]
m = np.array(game_result)
for row in [sum(i) for i in [m.diagonal(), np.fliplr(m).diagonal(), *[i for i in m], *[i for i in m.transpose()]]]:
if row == 3: return 'X'
if row == -3: return 'O'
return 'D'
Oct. 23, 2019