Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
probably not a very efficient way? solution in Clear category for Xs and Os Referee by bart.fiten
def checkio(game_result):
# Check rows
for row in game_result:
if row[0] == row[1] == row[2] != ".":
return row[0]
# Check colums
for col in range(3):
if game_result[0][col] == game_result[1][col] == game_result[2][col] != ".":
return game_result[0][col]
# Check diagonals
if game_result[0][0] == game_result[1][1] == game_result[2][2] != ".":
return game_result[1][1]
if game_result[2][0] == game_result[1][1] == game_result[0][2] != ".":
return game_result[1][1]
return "D"
Dec. 11, 2014
Comments: