Nim
The following procedures are defined:
As described in the assignment.
Given a proper return value from minimax, this function will nicely print out the sequence of moves in the game and who won. For example: (print-nim-game (minimax '(0 2 1) nim-gc nim-end?))
Lets you play Nim against your minimax function. If a second argument of #t is given, you get to go first.
Lets you play Coin-strip against your minimax function. If a second argument of #t is given, you get to go first.
In addition, read the comments in connect4.scm. There are some extensive comments there about how to get started and about the board representation. These functions are organized into the following sections:
[connect4] Accessors for parts of the board representation. See comments in connect4.scm
[connect4] Returns either X, O, or empty.
[connect4] Returns a list of the children of the given board, formed by the given player (either X or O) making a valid move.
[connect4] Returns a list of valid moves.
[connect4] Returns either X, O, draw, or #f.
[connect4] The representation for the starting (empty) board.
[a4code] Runs a game between two players. The x-player and o-player arguments must be player functions, i.e. functions that take a board and the player (X or O) and returns a move (an integer between 1 and 7 inclusive). The X player always goes first. Also see the comments in the connect4.scm file for more information.
[connect4] A player function that asks you what move you want to make.
[connect4] A player function that picks a random move.
[connect4] Returns the number of open sequences of pieces. By "open," I mean a sequence that can be extended into a longer sequence: the sequence does not end at the edge of the board nor is it "blocked" by an opponent's piece. See the connect4.scm file for information on what these functions return
[a4code] Resets the state count to 0.
[a4code] Increments the state count by count.
[a4code] Returns the state count.
Note that the inf:max and inf:min functions only handle two arguments, unlike the regular max and min functions.