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 Olygrim
def checkio(toe):
chn = "".join(toe)
sol = {"XXX", "OOO"}
#Toutes les possibilités de victoires dans un tuple
verif = (toe[0], toe[1], toe[2],
chn[0::3], chn[1::3], chn[2::3],
chn[0::4], chn[2::2][:-1])
#Si l'intersection n'est pas nulle, alors il y a une victoire
res = sol.intersection(verif)
if res:
#Renvoie "X" ou "O"
return tuple(res)[0][0]
else:
return "D"
May 6, 2015