

Turn = 'Player 2' #move on to player 2 THIS IS HOW TO ALTERNATE TURNS # if board is full but there's no winner, it's a draw

If is_board_full(game_board): # check to see if the board is full If check_winner(game_board, player1_marker): # if there are no more moves

Place_marker(game_board, player1_marker, position) # place marker at the positionĭisplay_board(game_board) # display board Position = player_choice(game_board) # ask for position from player If turn = 'Player 1': # if player 1 is first While game_on: # initiates the start of the game Play_game = input("Ready? Enter Yes or No.") Turn = go_first() # randomly choose who goes first Player1_marker, player2_marker = assign_marker() # assign players to marker # turn = '' # needs to be an empty string because we're storing the result of go_first(), a string, inside Here is the code for my gameplay: print('Welcome to Tic Tac Toe!') Here's the code for my game board: game_board = + (*9) As a result, the game ends before any single board has been filled. I am struggling with the code for the gameplay and would really appreciate advice anyone might have for overcoming this obstacle.Īn iteration of my game_board reprints every time a player makes a move. Does anybody know why ? (The problem can only be in the MiniMax function, or the nextMove function.I have been working on a Python tic-tac-toe game for about a month, and the end is finally in sight. I have implemented a TicTacToe algorythm with MiniMax, but the problem is that the computer always just places an 'x' on the next possible spot instead of evaluating the game.
