Chomp 0.2
Some random comments by the programmer
 	
 	The Game
The name of the game of Chomp comes out of the original idea: a bar of poisoned candy ruled into squares, and plays that consist of "chomping" a region of the bar while avoiding the one square that contains the poison.
The game is played on a rectangular grid of squares.  Square boards have very simple strategy, so square boards are not generally used.  The poison is one of the corner squares; since the computer opponents I've seen all have it in the lower-left corner, I designed this software around that idea and I will describe it that way.  Another corner could be used and the game would be essentially the same.

As of October 2012, you can play Chomp in these places: against Javascript at http://www.math.ucla.edu/~tom/Games/chomp.htm or against an applet at http://www.win.tue.nl/~aeb/games/rect.html

The players make moves in strict alternation.  A move consists of "chomping" one of the remaining squares in the grid, along with any remaining squares that are above it, to the right of it, or both.  The player who chomps the poison loses the game.
 	Terminology
For clarity, rather than calling a position won or lost, we will be more specific by calling them N-positions (won by the "Next" player) or P-positions (won by the "Previous" player.)  I may from time to time refer to the players as “winning” or “losing” to indicate the expected outcome of best play.
The term “move” will refer to a choice of a specific square for a chomp.  A “tempo” is similar, and indicates a single move by one player.
The term “weight” here will refer to the number of squares in a position, including the poison square.
The term “arena” is used here to refer to a rectangular bounding-box just large enough to contain any position to be considered.  An arena is said to be “compact” if the number of columns is within an order of magnitude of the number of rows, and is otherwise said to be “extended”.
 	The Project
This is a collection of programs to aid in the exploration of the solution space of the game Chomp.  It was inspired in part by a paper that won its high-school author US$100,000.  The paper was titled "Poset Game Periodicity" and was the first paper to address this family of games in a general way.
The present purpose is less grand.  I'm just putting together some things that helped me to explore the game of Chomp, and gave me a "move book" that allowed me to play against the computer opponents currently known to me without embarrassing myself too much.  This software is optimized for games in which the initial position is large in both directions.  Some interesting investigations have explored less symmetric starting positions, but go in one direction far beyond what this software can handle, primarily in the representation of positions.
This was all written in C on a Linux OS -- Xubuntu "precise" to be precise -- and is designed to work in the Unix shell command-line.  The hardware is a 4-core AMD FX-4100 clocked at 1.4Ghz, 8 GB of RAM and several terrabytes of available storage.
 	The Result
A run of the software is performed by the "chomploop.sh" script, which takes the board geometry as an input and creates a file of positions, one per line, with 4 fields per line.  The lines are printable but slightly encoded text.  The fields are:
ｷ	the position, described by column heights encoded one character per column.  The encoding is an extension of hexadecimal with the groups (0-9)(A-Z)(a-z)(-_) for 64 valid numbers in all.
ｷ	exactly 3 bytes: the letter P followed by the 0-based encoding of the column and row of the best move. (3 bytes)
ｷ	the game-theoretical value of the position.  Negative numbers are for P-positions and express how many moves the losing player can drag out the game against best play, and positive numbers are for N-positions and express how quickly best play can finish the game.
ｷ	The number of winning moves (0 for P-positions).
Examples: Records for the two positions with the most ways to win on a 12x12 board:
A88877655542 P27 54 7
CCBBA76411 P39 54 7