Question: use the python code below and add the AI: To implement the full version of tic-tac-toe, you need to create an Al (Artificial Intelligence) Player
use the python code below and add the AI:





To implement the full version of tic-tac-toe, you need to create an Al (Artificial Intelligence) Player that can play against the user. In this assignment, you have to create three different types of Al : a simple Al that chooses moves randomly, a sophisticated SmartAl that never looses a game because it is based heuristic approaches, and a MiniMax that also never looses a game because it precalculates all possible moves. All three Al classes should be placed in the same module, the file player.py, where the class Player is written. Al should be a subclass of the class Player and should inherit all properties from its superclass Player. The init and choose methods should be overridden (modified). The simplest implementation of an Al player is to use a random choice for generating a valid move. For this strategy, you need to create all possible moves: in the beginning of the game, all moves are empty cells on the board, so you can create a list of all cells and then remove the occupied cells from the board as the game progresses. You can import choice from the random module to randomly choose a cell (a move) from the list of all possible cells (moves). The output of the program should be the same as before, the user plays as Alice and the Al plays as Bob. The only difference from the previous tic-tac-toe game is that the user does not have to play for Bob, the Al (your computer program) plays instead of the user. To do so, you need to modify tictac.py to create an Al object: you can achieve it by substituting player1 = Player("Bob", "X") to player1 = Al("Bob", "X", board) and the import statement from player import Player to from player import Player, Al
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
