Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- game_on = True
- while game_on:
- print('Welcome to Tic Tac Toe!')
- board = ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ']
- player=choose_first()
- print(player)
- while not full_board_check(board):
- if player == 'Player 1 goes first':
- choice = player_input()
- if space_check(board, choice):
- place_marker(board, 'X', choice)
- display_board(board)
- else:
- print('Please pick an available position')
- choice = player_choice(board)
- place_marker(board, 'X', choice)
- display_board(board)
- player = 'Player 2 goes first'
- if win_check(board,'X'):
- display_board(board)
- print('You win with 3 Xs in a row!')
- break
- if player == 'Player 2 goes first':
- choice = player_input()
- if space_check(board, choice):
- place_marker(board, 'O', choice)
- display_board(board)
- else:
- print('Please pick an available position')
- choice = player_choice(board)
- place_marker(board, 'O', choice)
- display_board(board)
- player = 'Player 1 goes first'
- if win_check(board,'O'):
- display_board(board)
- print('You win with 3 Os in a row!')
- break
- if replay():
- game_on = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement