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 DaI17
from typing import List
def checkio(game_result: List[str]) -> str:
SIZE = 3
rows = game_result
columns = [[game_result[i][j] for i in range(SIZE)] for j in range(SIZE)]
diagonals = [[game_result[i][i] for i in range(SIZE)], [game_result[i][-(i+1)] for i in range(SIZE)]]
for lines in [rows, columns, diagonals]:
for line in lines:
if line.count("X") == SIZE:
return "X"
elif line.count("O") == SIZE:
return "O"
return "D"
Feb. 27, 2020