(eval-fn board player 'X)
A: No. MAX always makes the first move in a game tree. If your player is playing O, then whenever it analyzes a board to find the best move, MAX will place an O as the first move in this game tree starting from the given board state as the root node. Therefore, when your player is asked to determine the best move for X, MAX will be X, and when your player is asked for a move for O, MAX will be O.
A: No. However, this doesn't mean that you can't test it yourself. Here's the simplest way I can think of to test it:
(define (c4-eval b c m) (random 20)) (trace ab-max-player) (trace ab-min-player) (trace-exit c4-eval) (define my-player (create-c4-player c4-eval 2)) (my-player <some board state> 'x)Then look at the tracing output and draw the game tree to make sure your procedure is working correctly. Because this evaluation function returns a random value, you'll have to draw out the game tree to make sure it's doing the right thing. Of course, the other thing you could do is write a simple evaluation function...
A: Your alpha-beta minimax implementation should be customized for the Connect 4 game, so you should "hard code" the procedures c4-children and c4-end?.
A: No, the c4-end? procedure determines when the game is over. During the alpha-beta minimax search, if the game is over or you reach the depth cutoff, you should call the evaluation function to get the value of the game. Since the numerical scale of an evaluation function is completely arbitrary, you cannot hard code numbers as we did for problems 1 and 2 where we always searched until the end of the game.
A: I've just put up some examples in the "hints" section on the main assignment 4 page.
A: The reason this is structured like this is so that (1) an arbitrary Connect 4 evaluation function can be used with your alpha-beta minimax implementation and the depth cutoff can be specified, and (2) so that you use any node structure that you want.
The create-c4-player procedure returns a player procedure. This procedure has the given evaluation function and depth cutoff "built in." Two player procedures are given to the play-c4 procedure; the only question is has for a player during the match is: here's the board, and this is your symbol --- what's your move? Using alpha-beta minimax is not the only way to structure a player procedure. The random player and human player procedures are examples of this.
I've just put up an example create-c4-player procedure in the "hints" section on the main assignment 4 page.
A: I haven't worked out the specifics yet, but here's the basic idea. There will be some fraction of the points for simply having uploaded a working evaluation function that is accepted by the system. Another fraction of your grade will be based on some absolute standards --- I'll have some "reference players," one of which will certainly be the random player. There will also be some (not too complicated players). If you put some effort into your evaluation function, you should be able to beat at least some if not all of them. And finally, there will be some fraction of the points based on "relative performance" --- we'll run a round robin tournament with all accepted evaluation functions and award points proportional to your rating in this tournament. I'll tentatively state that the "relative performance" fraction of the points for this problem will be no more than one quarter.
A: You must use your create-c4-player to create a "player function." This function can then be an argument to the play-c4 procedure:
(define my-player (create-c4-player c4-eval 4)) (play-c4 my-player human-player)