Created
February 1, 2017 03:27
-
-
Save shamikalashawn/d540e12e8bbe4c7ee121690d1ca78729 to your computer and use it in GitHub Desktop.
The skeleton of the game is there. X and O take turns and the gameboard updates with each round.
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
theBoard = {'top-L': ' ', 'top-M': ' ', 'top-R': ' ', | |
'mid-L': ' ', 'mid-M': ' ', 'mid-R': ' ', | |
'low-L': ' ', 'low-M': ' ', 'low-R': ' '} | |
def printBoard(board): | |
print(board['top-L'] + '|' + board['top-M'] + '|'+ board['top-R']) | |
print('-+-+-') | |
print(board['mid-L'] + '|' + board['mid-M'] + '|'+ board['mid-R']) | |
print('-+-+-') | |
print(board['low-L'] + '|' + board['low-M'] + '|'+ board['low-R']) | |
turn = 'X' | |
for i in range(9): | |
printBoard(theBoard) | |
print ('Turn for ' + turn + '. Move on which space?') | |
move = input() | |
theBoard[move] = turn | |
if turn == 'X': | |
turn = 'O' | |
else: | |
turn = 'X' | |
printBoard(theBoard) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment