Rules
Nine-board tic-tac-toe is a
tic tac toe variant
where nine ordinary, 3-by-3 tic-tac-toe boards make up a 3-by-3
array. Players take turns making marks (human 'X', computer 'O') in the
ordinary tic-tac-toe boards. The first mark can appear anywhere. Each
subsequent mark gets made in any un-marked spot in the ordinary board that
corresponds to the spot where the previous mark got made.
The usual 3-in-a-row arrangement of marks in any of the 9 ordinary boards
wins.
Design
Nine-board tic-tac-toe runs entirely in your browser. It's an all-JavaScript
program. Reset is done by JavaScript, the "reset" or "new game" button
will not retrieve the HTML and JavaScript again.
This program uses a stock alpha-beta minimax algorithm.
It does calculate the utility function incrementally, rather than
doing the entire calculation at each terminal node in the game tree.
Configuration
A strength of 4 will handily defeat humans who have never
played Nine-board before, and most who have. A stregth of 6 causes firefox
to complain about slow scripts. Your machine might be faster.
A strength of 0 causes the program to use the static utility
function only - no mini-maxing happens. This is pretty easy to beat
as it don't look ahead even 1 move to see who might win.
You probably want to use even values for strength: odd numbers look one
move ahead for how the computer assumes the human will move, and causes
goofy results.
Download and Install
Doing a "view source" or "save file" or a command like
wget http://stratigery.com/gen9.html should get you a copy
of the source code. It's a single file, no images or extra JavaScript files.
Putting gen9.html in your DocumentRoot directory
should allow you to place a relaxing game of Nine-Board-Tic-Tac-Toe from
your own personal server. I encourage you to do this.
|