Skip to content

Instantly share code, notes, and snippets.

@luxu
Created January 12, 2019 20:01
Show Gist options
  • Save luxu/d22ef1176255ae07ec26dc6c96860c3a to your computer and use it in GitHub Desktop.
Save luxu/d22ef1176255ae07ec26dc6c96860c3a to your computer and use it in GitHub Desktop.
tabuleiro = {'top-L':' ','top-M':' ','top-R':' ',
'mid-L':' ','mid-M':' ','mid-R':' ',
'low-L':' ','low-M':' ','low-R':' '}
def imprimeTabuleiro(tabuleiro):
print(tabuleiro['top-L'] + '|' + tabuleiro['top-M'] + '|' + tabuleiro['top-R'])
print('-+-+-')
print(tabuleiro['mid-L'] + '|' + tabuleiro['mid-M'] + '|' + tabuleiro['mid-R'])
print('-+-+-')
print(tabuleiro['low-L'] + '|' + tabuleiro['low-M'] + '|' + tabuleiro['low-R'])
turn = 'X'
for i in range(9):
print(imprimeTabuleiro(tabuleiro))
print('Turn for ' + turn + '. Move on which space?')
move = input()
tabuleiro[move] = turn
if turn == 'X':
turn = 'O'
else:
turn = 'X'
print(imprimeTabuleiro(tabuleiro))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment