Guide to Assignment 4 support code

The code for this assignment is in two different files: one with compiled Scheme code, a4code.com, and one source code file connect4.scm. The former contains support code for the Nim and Coin-strip games. Support code for the Connect 4 game is in both files. You should load both files from your Scheme code file. The information on this page is organized into the following sections:

whuang@cs.rpi.edu; email
Last updates: October 11; September 30, 2000


Nim

The following procedures are defined:

Coin-strip

The following procedure is defined:

Connect 4

The support code for Connect 4 is split between the a4code.com and connect4.scm. The code you need to see (mostly that code which deals with the board representation and functions to analyze a board) appears in the latter. Code that you don't really need to see appears in the former. The file where each function is defined appears in the documentation below.

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:

Board representation and accessors

Playing Connect 4

Functions for analyzing a Connect 4 board

These functions should be useful for creating your evaluation function.

Other useful functions

Counting states

I am providing a mechanism for you to count the number of states that you evaluate without having to pass an extra argument to all your functions. The following functions provide a way to manipulate a global counter.

Handing infinity

I am providing a few functions that operate on the real numbers extended to include the symbols pos-infinity and neg-infinity. These functions are all in a4code.com.

Note that the inf:max and inf:min functions only handle two arguments, unlike the regular max and min functions.