# 4 × 4 × 4 Tic Tac Toe

OpenGL and Java have been finally fused. The applet below is one of many samples bundled with the Java OpenGL libraries. The sample can be freely copied and distributed. I thought I'd do just that before learning programming OpenGL myself. This is a delightful example of 3d graphics.

The game is a 3d tic-tac-toe, known as tic-toc-tac-toe.

To play the game, drag the mouse.

If you were using a Java-capable browser, you would see a tic-toc-tac-toe 3d field instead of this paragraph.

### This applet requires Sun's Java VM 2 which your browser may perceive as a popup. Which it is not. If you want to see the applet work, visit Sun's website at https://www.java.com/en/download/index.jsp, download and install Java VM and enjoy the applet.

Oren Patashnick is said to have [WW, p. 674] shown that the player to start the game have a winning strategy. So unlike the original 2d 3×3 game that ends in draw provided the players make no stupid moves, the first player has a chance at winning. This is a theory. As you may observe, it's not at all simple to achieve a win in practice.

#### Problem [500 Challenges, problem 444]

How many different ways are there to place 4, say, crosses in a winning streak?

### Solution

Consider a 6×6×6 board centered around the given 4×4×4 cube. Each winning line of the latter intersects exactly two 1×1×1 cubes in the outer shell. On the other hand, each such 1×1×1 cube located in the outer shell lies on a single winning line. The total number of the winning lines therefore is given by

(63 - 43) / 2 = 76.

(You can verify this approach on the common 3×3 board: (52 - 32) / 2 = 8, as expected.)

### References

1. E. J. Barbeau, M. S. Klamkin, W. O. J. Moser, Five Hundred Mathematical Challenges, MAA, 1995.
2. E. R. Berlekamp, J. H. Conway, R. K. Guy, Winning Ways for Your Mathematical Plays, Volume 2, Academic Press, 1982