In Unit 2, you developed the beginnings of several board games and specialized it to play Tic Tac Toe. Now you'll extend that project to keep track of theTic Tac Toe moves and recognize when someone wins. Later, you'll be able to teach the machine to play, too.
that will become a list of moves. At the start of the game, this list must be initialized empty.
that takes the two inputs and reports the list of those two.
that translates a costume number (1 or 2) into a player's symbol (x or o). You can use it like this:
which cell? to find the cell number.
takes a move (a list like {x, 5}) as input and reports only the player (e.g., x).
takes a move as input and reports only the cell number (e.g., 5).when I am dropped script so that it adds each move to current game. Start a new game and make three or four moves to make sure that it works.current game to see if that is a free cell.
predicate that takes a cell number as input and tests it against every move in current game. The free cell? block should use a higher order function to extract just the cell numbers from current game as a list and find out if that list contains the cell number that was given as input.free cell? with the numbers of both free and occupied cells.when I am dropped script again so that a move is allowed only if it's to a free cell.The next goal would be to create a way for the program to tell if a player's move has resulted in a win. The following instructions suggest one way, but if you want to experiment and come up with your own method, feel free to do that. Then skip down to the last instruction below.
to clear your tic-tac-toe board and initialize (empty out) current game. Play one game, deliberately letting x win.
-equals-x)-from-Current-game.png)
)-over-Keep-items-such-that(item-1-of-()-equals-x)-from-Current-game.png)
player x cells and player o cells that report a list of cells that the players occupy.

)-contains(item-2-of())-from-Current-game.png)
-contains(item-2-of())-from-Current.png)
that takes a list of a player's cells and one winning combination and reports whether those cells contain all three elements of the winning combination. One way to do it could start like this:
report?win? that takes a player (x or o) as input and checks to see if that player wins.when I am dropped script so that when a player wins the game, the program notifies the players.