Question 3: Tic-Tac-Toe View Past Answers 3.1 Move Write the function place_piece(board, pos, piece) that takes the Tic-
-
- Site Admin
- Posts: 899603
- Joined: Mon Aug 02, 2021 8:13 am
Question 3: Tic-Tac-Toe View Past Answers 3.1 Move Write the function place_piece(board, pos, piece) that takes the Tic-
Question 3: Tic-Tac-Toe View Past Answers 3.1 Move Write the function place_piece(board, pos, piece) that takes the Tic-Tac-Toe board game board, the input position pos and the player piece piece. The function modifies the board if the input is valid such that the player piece placed in the given position. If the board is modified, the function returns a Boolean (bool) True indicating the move was valid. Otherwise, return false and the board is left unmodified signifying the move was not valid. 3.2 Who Wins? a Write the function check_win(board) to check if the Tic-Tac-Toe board game board has a winner. If there is a winner, return the piece of the winner (i.e., either 'O' or 'X'). Otherwise, the game has no winner and simply return an empty string You are guaranteed that there will be at most one winner. 11