Last active
November 24, 2020 09:30
-
-
Save rioj7/56751210439737ffb54d71b06cd65ea3 to your computer and use it in GitHub Desktop.
tic-tac-toe board check
This file contains hidden or 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
# https://stackoverflow.com/questions/64983060/how-can-i-make-this-tic-tac-toe-code-work | |
# Consider using this function | |
def checkBoard(board, turn): | |
winLine = [ (1,2,3), (4,5,6), (7,8,9), (1,4,7), (2,5,8), (3,6,9), (1,5,9), (3,5,7) ] | |
for p,q,r in winLine: | |
if board[p] != ' ' and board[p] == board[q] and board[p] == board[r]: | |
printboard(board) | |
print("\nGame Over.\n") | |
print(' *****' + turn + ' vann. yippie*****') | |
return True | |
return False |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment