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 DanielDou
# From Daniel Dou with love...
def checkio(board):
# First we put everything together into a single string
x = "".join(board)
# Next we outline the 8 possible winning combinations.
combos = ["012", "345", "678", "036", "147", "258", "048", "246"]
# We go through all the winning combos 1 by 1 to see if there are any
# all Xs or all Os in the combos
for i in combos:
if x[int(i[0])] == x[int(i[1])] == x[int(i[2])] and x[int(i[0])] in "XO":
return x[int(i[0])]
return "D"
Feb. 24, 2014
Comments: