Created
October 15, 2018 16:39
-
-
Save beltiras/a71880eca858c4f2b710b32e435d27af to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def check_win(game_state, token): | |
all_rows = [[line[x] for line in game_state] for x in range(len(game_state))] + [game_state[len(game_state)-x-1][x] for x in range(len(game_state))] + [game_state[x][x] for x in range(len(game_state))] | |
for line in all_rows: | |
if sum([1 for t in line if t == token]) == len(game_state): | |
return token | |
return " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment