Nine-board Tic Tac Toe

Strength 2

 



 

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 is a distributed system: the user interface, written in JavaScript, runs entirely in your browser. Move calculation, written in PHP, runs in the web server.

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.

Download and Install

This version uses Sajax version 0.13 for communication between the user interface and the move calculation. Download sajax-0.13.zip, unzip it, and put files sajax.php, json2.parse.js, json2.stringify.js, json_parse.js, json_parse_state.js, json_stringify.js, and sajax.js in a directory under the web server's DocumentRoot. Download the PHP file, rename it to gen9.php, and move it to the same directory used for the Sajax files above.

Configuration

As currently configured, the program does a 4-level deep search of the game tree for the best move. Changing the value of $DEPTH_LIMIT in the PHP code to a greater value will make it search deeper, and take longer to decide. A value of 4 will handily defeat humans who have never played Nine-board before, and most who have.