"Every game ever invented by mankind, is a way of making things hard for the fun of it!"
-- John Ciardi

Shall We Play a Game?
Fall 2001 CS3 Final Project
a.k.a. Gamesman for Scheme

(last updated 2001-11-30 @ 3am)

Overview

This is the main resource page for detaills about submissions, bug fixes, and answers to frequently asked questions about your final project.

Announcements

2001-12-02 : First Annual CS3 Best Gamesman Game competition!

The templates of the two games with a variable board size -- Kayles and Toads and Frogs -- include two procedures CHANGE-INITIAL-POSITION and DISPLAY-INITIAL-POSITION that take care of reading an intial position from the user. These procedures do a substantial amount of the error-checking and come with their own help messages. Feel free to modify these two procedures, or not to touch them at all -- they already do everything that you should need as far as reading and setting an initial-position. It is up to you, however, to modify as many of the Big Five procedures ( as neccesary to accomodate play on an a variable-sized linear board. The boards for Snake, TacTix and Poison do not change size from 3x3; when the compulsory rules ask you to "Enter an arbitrary initial position", we mean for you to enter a position within a3x3 board. Now, that said, there's nothing stopping the Scheme Jedis from changing the board to be able to be larger than 3x3 and changing the hash functions as well.

Handouts & Source Code

Checkoffs

: (set-rule! 'standard-game #t)  ;; the default, "standard" game
: (print-help)                   ;; this should print the "standard" rules
: (set-rule! 'standard-game #f)  ;; the "misére" game
: (print-help)                   ;; this should print the "misére" rules

Known Bugs, Fixes (when available), and Questions

TacTix Kayles Toads and Frogs Snake Poison

2001-11-12: If, in generate-moves, we want to list one-piece-removal moves by themselves as numbers instead of as a one-element list, is that ok? E.g., (2 4 5 (4 5) (2 5)) instead of ((2) (4) (5) (4 5) (2 5))? [Sure, it's OK, in fact it makes for a much nicer interface! Just make sure you handle it correctly in do-move.]

2001-11-12: An earlier post that the example call in generate-moves was incorrect was itself wrong. The return values described above are correct. The original file was fine and has been updated online.

2001-11-18: Clarification of the compulsory rules: "Remove pieces from any row or column even if they aren't contiguous". So, given the following position, in standard and misere rules, you can only take (1), (3) or (8), but with these rules, you can also take (1 3).

1 2 3 | o - o
4 5 6 | - - -
7 8 9 | - o -
2001-11-11 : The table and mkayles.scm differed slightly in their representation: the table used o and - for slots, and the template used i and _. We've decided to change the table to correspond to the template and use i and _.

2001-11-09 : (display-initial-position) in mtoads.scm had a bug (position was undefined). We have fixed it and put the corrected version online.

2001-11-11 : The table and mtoads.scm differ in two ways. First, the example game in the table has 8 slots whereas the template has only 6. Don't worry about the difference; the table was only showing an example game. Feel free to use the 6-slot default initial position from mtoads.scm for checkoff 1. Second, the table says the first word in the position is l or r whereas the template says left-turn or right-turn. We've changed the table to now say left-turn or right-turn.

2001-11-12: The representation in mtoads.scm was backward; we have fixed it and put the corrected version online. Unfortunately, this significantly changes the template enough that students are encouraged to copy their modifications to the new template. Check UPDATE HIST to assure you have the latest version.

2001-11-10 :
(set-rule! 'initial-position ...
in msnake.scm was wrong. We have fixed it and put the corrected version online.

2001-11-11 : Added the following lines to the hash section of msnake.scm and put it online:

;;; Begin bug-fix-2001-11-11
(define blank      '-)
(define snake-body 'o)
(define (blank? cell)
  (equal? cell blank))
(define (snake-body? cell)
  (equal? cell snake-body))
;;; End bug-fix-2001-11-11

2001-11-12 : The snake cannot bite itself or run off the board -- those are always illegal moves in both the Standard and misére games. Thus, the misére goal is NOT to bite yourself first, it's to force your opponent to make the last legal move.

2001-11-12 : In print-position in msnake.scm there was a call to draw-tactix instead of draw-snake. We have fixed it and put the corrected version online.

2001-11-18: Can you explain what "players only control a particular head" means? [L would always move first and only control the head; R would control the tail. You now have to know whose turn it is -- count the snake segments for that (odd=Left's turn).]

2001-11-19: In the template, why does your example show generate-moves on the position below returning((h 4) (h 8))? Shouldn't it return ((h 4) (h 8) (t 4) (t 8))? [The author of the template assumed h always moves first. You are free to make that assumption or not. Your call.]

1 2 3 | - - -
4 5 6 | - - -
7 8 9 | h - -

2001-11-09 : Left always moves first, correct? [Correct!]

2001-11-11 : Only the knight jumps over pieces, correct? [Correct!]

2001-11-11 : Changed opponent to return 'L and 'R and added the following lines to the hash section of mpoison.scm and put it online:

;;; Begin 2001-11-11 fix
(define poisoned 'x) 
(define blank    '-)
;;; End 2001-11-11 fix

2001-11-18: Can queens, bishops and rooks jump over poisoned slots? [No, only knights can. Poisoned slots are "occupied" as far as piece movement goes.]

2001-11-30: If I load an initial position from the user, isn't it the case that I don't need to ask who should go first because the number of poisoned slots always talls me? Specifically, doesn't that mean that if the position has an odd number of poisoned slots, Right will go first? [Exactly right!]



Questions, comments, bugs with gamesman? Email cs3-gamesman@nim.cs.berkeley.edu