Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Xs and Os Referee by Ordik
from typing import List
def checkio(game_result: List[str]) -> str:
gr = game_result
if gr[0][:-1] == gr[0][1:] == 'XX' or\
gr[1][:-1] == gr[1][1:] == 'XX' or\
gr[2][:-1] == gr[2][1:] == 'XX' or\
gr[0][0] == gr[1][0] == gr[2][0] == 'X' or\
gr[0][1] == gr[1][1] == gr[2][1] == 'X'or\
gr[0][2] == gr[1][2] == gr[2][2] == 'X'or\
gr[0][0] == gr[1][1] == gr[2][2] == 'X'or\
gr[2][0] == gr[1][1] == gr[0][2] == 'X':
return 'X'
elif gr[0][:-1] == gr[0][1:] == 'OO' or\
gr[1][:-1] == gr[1][1:] == 'OO' or\
gr[2][:-1] == gr[2][1:] == 'OO' or\
gr[0][0] == gr[1][0] == gr[2][0] == 'O' or\
gr[0][1] == gr[1][1] == gr[2][1] == 'O'or\
gr[0][2] == gr[1][2] == gr[2][2] == 'O'or\
gr[0][0] == gr[1][1] == gr[2][2] == 'O'or\
gr[2][0] == gr[1][1] == gr[0][2] == 'O':
return 'O'
return "D"
Nov. 17, 2020