A couple of obvious places for generalization, on your connect5: - Certainly, the magic number 5 should not occur in many places in your program. (If we changed the program at the last moment to be connect-6, your program should still play, w/ only changing one line.) - In fact, you have function(s) which look for streaks of length WIN-LENGTH, a constant. While that's all that's needed for the program, you might easily pass these functions a number k, and have them just look for streaks of length k. No extra work, and you might be able to re-use this. - You might have different functions, one to look in each different direction; these are all pretty similar. What parts can you circle as differing between them, and then combine the similar functions into one, just passing the differing bits as parameters? **Hint** You might think "This function adds 1 to row, while this other doesn't change row at all, so they can't be combined". Consider: "This function adds 1 to row, while this other adds 0 to row. It will be fun to clean up my code by factoring out the row-offset!" - There's no need to use set! for this assignment. If you use it, ask yourself whether it is truly appropriate, or if just having functions return values suffices. Exception: if searching the game tree, you might use set! to communicate the idea of the best-soln-so-far between branches of the recursion (rather than passing an accumulator around). - Note that the use of 'X, '-, 'O for a board-square is being used to input the data, but is NOT necessarily the same as your internal representation of a board-square. (It *is* a better representation than, say, +1,0,-1, since you don't do arithmetic on board-squares.) - If you want to run a scheme program from the UNIX command line, you can start up mred and tell it to run your file. (mred is mzscheme (the underlying scheme engine -- ie bottom window of drscheme) plus the gui libraries (so that it can read files with comment-boxes).) Create a file "go" with the following two lines in it: #! /bin/sh mred -L plt-pretty-big.ss lang --script myfile.ss (You can use any editor -- including DrScheme -- to make this two-line file.) Then, make this file executable: From the owlnet prompt, type chmod a+x go Now, "go" is an executable file; typing "go" will run your scheme program. (If you get an error "Unable to open display", it means you need to run this on an owlnet machine with a (X windows) screen -- any machine in a lab will suffice.) - The above can be nice when combined with unix's idea of redirecting input. From the unix prompt, go < some-input-file Will run "go", and rather than reading from the keyboard, that program will get input from some-input-file. For example: As you can put together: making "go" be a script which starts your connect5 player, and then re-directing your test cases in, you can test your whole program, without having to type the input.