CSCI 4150: Introduction to Artificial Intelligence, Fall 2004 |
(load "play-myc4") (load "myevalfunction.scm") ; this file must load a4code and connect4
This file contains the procedure (play-myc4 your-depth-cutoff . humanfirst)
This allows you to play against your evaluation function. If you give it an optional argument (any value), then you get to go first. For example:
(play-myc4 5 #t) ; depth 5, human goes first
If you want to see what your evaluation function is doing, you can set the variable print-narration to #t. Be warned that this will produce a lot of output! (Type C-c C-c to interrupt it in emacs/edwin, C-g in the command-line version.)
For example, to play against test player #1, you would call:
(load "play-test-c4") (load "my-player") ; this should load a4code and connect4 (play-test-c4 1 4) ; play against test player #1 ; your evaluation function goes to depth 4By default, the test player plays first. For your player to go first, give an optional second argument (any value). For example:
(play-test-c4 1 4 #t)You may choose which player goes first for the two annotated games.
To take advantage of this, you need to define the variable depth-one-moves which must be an integer between 1 and 8 inclusive. If it is not defined, or if it has an invalid value, then this a value of zero is used (so that all moves are searched to the full depth by the ab-minimax.
The new code in the web tester also sets a variable in your environment called tester-depth-limit which is the depth cutoff for your evaluation function.
See test-openingdb.scm for a simple example. (This is a modification of the ref1 player.)
To help you run your evaluation function on these boards, I have put together yet another version of my ab-minimax solutions. The file is: test-myc4.com. It contains one procedure,
(test-myc4 board-number depth-cutoff player)This has the test board states hardcoded in the procedure. For example:
> (load "my-evalfn") ; this should load a4code and connect4 > (load "test-myc4") > (test-myc4 5 'X 4) ; do test board b5, X to move, depth 4This will not only run your evaluation function under my ab-minimax, but it will also tell you the move, the value of the subtree, and it will print out the sequence of moves that led to that value!
Here's an example annotated game. However, because i did this with a very simple evaluation function, the analysis that I can offer on this trascript is not so in-depth. Yours should be more in-depth.
For this assignment the syntax checker has been configured to permit just about everything that you'd want to use — mutators, internal definitions, named lets, begin, multiple forms in implicit begins, iterative forms, etc. One thing that is still prohibited (because I consider it a security risk) is "eval".
None of the things above are strictly necessary to do this assignment. Some of them, such as internal definitions, are handy; others, mutators in particular, can get you into trouble if you don't know what you're doing!
This web tester is only for submission of a "minimally competent" evaluation function which is worth 8 points of Problem 4.
Here is the reference player you need to beat for this problem: ref1-eval.scm. Actually, this isn't quite true — the evaluation function is this code plus a little hack to make the reference player take the center column on the first move. (However, you'll have to figure that out yourself if you want to do that!)