Unfortunately, you don't have the Java language, so you can't see it work.

Rules for the turnablock game

The game is very simple. You and the computer take turns flipping tokens: black squares turn to white and vice versa. Whoever turns the whole board to white (the target) first wins. The only condition is that the lower right corner of the rectangle must be black (the base).

Play: Click on a black piece then drag to specify your rectangle to flip. Note: the square that you click will be the lower right corner of your rectangle. You can change the size of the board from 3x3 to 8x8. You can also select an easy or hard opponent. Click restart to start the game over.

This game was invented by J. H. Conway, and was described in the Mathematical Games column of Scientific American. The winning strategy is described there, and is related to the winning strategy for Nim. The hard setting implements the winning strategy, while the easy setting just tries to avoid making boneheaded moves. You can look at the Java console to see how you're doing.

A couple interesting points about the game. The player who goes first (i.e. you) can force a win by playing properly except for boards of size 3x4, 3x8, 4x7, and 7x8, for which the second player can force a win. Also, note that the game is guaranteed to eventually end; you can't flip forever.

The source is here.

You can find web pages with descriptions of more Conway games here and a collection of mathematical games links by Prof. Eppstein and Jeff Erickson.

You may also be interested in Conway's (surprisingly expensive) book Winning Ways: For Your Mathematical Plays.

Ken Shirriff: shirriff@eng.sun.com
This page: http://www.righto.com/java/turnablock.html
Copyright 2000 Ken Shirriff. Last updated 3/13/2001. Java and other Java-based names are trademarks of Sun Microsystems, Inc. and refer to Sun's family of Java-branded technologies. Use of this software is subject to the terms of the license agreement.