A Perfect Qubic-Playing Program

by Roberto Waldteufel

The game of Qubic is a 3-dimensional version of the familiar game of Noughts & Crosses (Tic Tac Toe in America). Unlike its trivial 2-dimensional sibling, Qubic is a difficult and moderately complex game. The aim is to get 4 in a row in any direction within a 4x4x4 cube.

The game was studied by Oren Patashnik, who published "Qubic: 4x4x4 Tic-Tac-Toe", in Mathematics Magazine, 53(4):202--216, September 1980, proving that Qubic is a first person win when played perfectly. In 1992 Victor Allis and Patrick Schoo wrote the first Qubic computer program guaranteed to win when playing first under tournament conditions. This program has never been made public, but has competed in the Computer Games Olympiad, winning all the games where it played first and also about half the games where it played second, which was sufficient to win a gold medal. Subsequently they published their paper on solving the game, and it was removed from the list of games at future Olympiads.

In September 2004 your webmaster independently solved the game of Qubic and wrote the program offered here. It playes perfectly in the sense that it always wins when it goes first, but it does not necessarily find the shortest win. The ZIP file is about 2 MB, and the unzipped files will occupy about 5 MB of hard disc space. Simply unzip and run the file Qubic.exe.

Enjoy :o)

Download QUBIC

In Spring 2007 I became a full time nomad, technically homeless, but living on the road in an old bus. I lost most of my possessions from my house-dwelling days, including my desktop computer with the source code to this and many other programs I had written, as well as my compiler and other software tools that I used to use to develop AI projects, but by chance in late 2017 after over a decade on the road, during which time I had done no programming at all, I stumbled upon Oren Patashnik's old opening book for the game on the internet, which piqued my interest. I don't often have enough electricity to spend the sort of time on my laptop needed to write artificial intelligence programs, but nevertheless I downloaded an open source free compiler and used this opening book to write another Qubic program called Oxo, which also always wins when it goes first, but is much leaner in that it only occupies about a quarter of a megabyte unpacked, and the zip file is under 100 kilobytes. The graphics are not quite as nice as the first version, but in strength they are about equal. Simply unzip and run the file oxo.exe.

Download OXO