Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
1 contributor

Users who have contributed to this file

18206 lines (16804 sloc) 587 KB
import sys
if sys.version_info[0] == 2:
input = raw_input # python 2 compatibility
print('Welcome to Tic Tac Toe!')
print('You are X.\n')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '1':
print('O moves on the top-right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the bottom-right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '7':
print('O moves on the right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the right space.')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '3':
print('O moves on the bottom-center space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '7':
print('O moves on the left space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the top-left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '4':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '3':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the bottom-right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the bottom-right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '4':
print('O moves on the right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the left space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the top-center space.')
print(' | | ')
print(' | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '7':
print('O moves on the bottom-center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the bottom-center space.')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '7':
print('O moves on the right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the right space.')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the bottom-right space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '7':
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '8':
print('O moves on the top-left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the left space.')
print(' | | ')
print(' | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the top-center space.')
print(' | | ')
print(' | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '7':
print('O moves on the top-center space.')
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the bottom-center space.')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '7':
print('O moves on the left space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the top-left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the bottom-center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '7':
print('O moves on the left space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the bottom-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the right space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '3':
print('O moves on the bottom-center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the bottom-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the top-center space.')
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the right space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the bottom-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '8':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the bottom-right space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the right space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '8':
print('O moves on the top-left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the bottom-right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '3':
print('O moves on the bottom-center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '6':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '4':
print('O moves on the bottom-right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the bottom-center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '3':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '4':
print('O moves on the right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '3':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the left space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '3':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the bottom-right space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '2':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '4':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the bottom-center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | O ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '2':
print('O moves on the bottom-left space.')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '3':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '4':
print('O moves on the top-right space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print('O moves on the top-center space.')
print(' | | ')
print(' O | O | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' O | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the center space.')
print(' | | ')
print(' O | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '5':
print('O moves on the left space.')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the left space.')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the left space.')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '9':
print('O moves on the left space.')
print(' | | ')
print(' O | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | X ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '4':
print('O moves on the bottom-right space.')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print('O moves on the top-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print(' | | ')
print(' | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('You have won!')
sys.exit()
if move == '9':
print('O moves on the top-center space.')
print(' | | ')
print(' | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('It\'s a tie!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '7':
print('O moves on the top-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '8':
print('O moves on the top-left space.')
print(' | | ')
print(' O | X | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '9':
print('O moves on the top-left space.')
print(' | | ')
print(' O | | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | O | X ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '7':
print('O moves on the top-right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | | ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('Enter the number of your move:')
print(' 7|8|9')
print(' -+-+-')
print(' 4|5|6')
print(' -+-+-')
print(' 1|2|3')
move = input()
if move == '5':
print('O moves on the right space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' X | X | O ')
print(' | | ')
print('---+---+---')
print(' | | ')
print(' O | X | O ')
print(' | | \n')
print('The computer wins!')
sys.exit()
if move == '6':
print('O moves on the center space.')
print(' | | ')
print(' X | | O ')
print(' | | ')
print('---+---+---')