Advertisement
Guest User

Untitled

a guest
Jun 26th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. game_on = True
  2. while game_on:
  3.  
  4. print('Welcome to Tic Tac Toe!')
  5. board = ['#',' ',' ',' ',' ',' ',' ',' ',' ',' ']
  6.  
  7. player=choose_first()
  8. print(player)
  9.  
  10.  
  11. while not full_board_check(board):
  12. if player == 'Player 1 goes first':
  13. choice = player_input()
  14. if space_check(board, choice):
  15. place_marker(board, 'X', choice)
  16. display_board(board)
  17.  
  18. else:
  19. print('Please pick an available position')
  20. choice = player_choice(board)
  21. place_marker(board, 'X', choice)
  22. display_board(board)
  23.  
  24. player = 'Player 2 goes first'
  25.  
  26. if win_check(board,'X'):
  27. display_board(board)
  28. print('You win with 3 Xs in a row!')
  29. break
  30.  
  31. if player == 'Player 2 goes first':
  32. choice = player_input()
  33.  
  34. if space_check(board, choice):
  35. place_marker(board, 'O', choice)
  36. display_board(board)
  37.  
  38. else:
  39. print('Please pick an available position')
  40. choice = player_choice(board)
  41. place_marker(board, 'O', choice)
  42. display_board(board)
  43.  
  44. player = 'Player 1 goes first'
  45.  
  46. if win_check(board,'O'):
  47. display_board(board)
  48. print('You win with 3 Os in a row!')
  49. break
  50.  
  51. if replay():
  52. game_on = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement