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 Saingue_Lainglin
from typing import List
def checkio(game_result: List[str]) -> str:
h = game_result
# transposed (°90 rotation)
v = ["".join(l) for l in zip(*game_result)]
# diagonals
d = [
"".join([h[i][i] for i in range(3)]),
"".join([h[i][2-i] for i in range(3)]),
]
# check all combination
for c in d+v+h:
s = set(c)
r = "".join(s)
if len(r) == 1 and r != ".":
return r
return "D"
Aug. 28, 2018