Man pages sections > man6 > xpanex

xpanex - Panex X widget

PANEX(6) Games Manual PANEX(6)


xpanex - Panex X widget


/usr/games/xpanex [-geometry [{width}][x{height}][{+-}{xoff}[{+-}{yoff}]]] [-display [{host}]:[{vs}]] [-[no]mono] [-[no]{reverse|rv}] [-{foreground|fg} {color}] [-{background|bg} {color}] [-tile {color}] [-pyramid{0|1} {color}] [-delay msecs] [-[no]sound] [-moveSound {filename}] [-{font|fn} {fontname}] [-tiles {int}] [-{mode {int}|hanoi|algorithme|panex}] [-userName {string}] [-scoreFile {filename}] [-scores] [-version]


Panex - A grooved sliding tile puzzle created by Toshio Akanuma and manufactured by the Tricks Co., Ltd of Tokyo, Japan (a Magic Company) in the 1980's. Mathematicians at Bell Laboratories calculated the number of moves to be 27,564 to 31,537. It came in two varieties: one with a magenta and a orange pyramid of order 10 on silver tiles; in the gold version pieces of each color look alike (i.e. no pyramid is drawn on them), this is a little harder. The goal in this puzzle is to simply exchange the 2 piles. Pieces with smaller trapazoids can not go down as far as pieces with bigger trapazoids.
The original Tower of Hanoi puzzle is the invention of Edouard Lucas and was sold as a toy in France in 1883. The legend of 64 disks in the great temple of Benares of the god Brahma is also his invention. The goal in this puzzle is to move the pile from the left side to the right most column. Unlike panex, a large trapazoid can not go on top of a smaller one, but pieces always fall to the bottom.
The original Algorithme 6 is 2 stacks of 3 wooden spheres on 2 of 3 posts. The spheres come in 3 different sizes. The goal goal is to swap the spheres using the posts without putting a bigger sphere on a smaller one and without exceeding the size of the post. It was created and produced by Patrick Farvacque around 1997. The puzzle presented here has a simpler solution because the tiles are all the same height (i.e. a 39 move solution as opposed to 66).


Press " mouse-left" button to move a tile in the top tile of a column. Release " mouse-left" button on another column to move the tile to that column. It will not move if blocked.
Click " mouse-right" button, or press "C" or " c" keys, to clear the puzzle.
Press " R" or "r" keys to read a saved puzzle.
Press " W" or "w" keys to save (write) a puzzle.
Press " U" or "u" keys to undo a move.
Press " E" or "e" keys to redo a move.
Press " S" or "s" keys to auto-solve. Unfortunately, its only implemented from the starting position.
Press " M" or "m" keys to switch between Hanoi (one pyramid column), Algorithme, and Panex, (each has two pyramid columns) modes (they each have different rules).
In Hanoi, one can not place larger trapezoid on a smaller trapezoid. Here the goal is to move the pile from the left peg to the rightmost peg.
Algorithme is similar, here we must exchange tiles and we are limited by the size of the stack. A move from stack 1 to stack 3 and vice-versa when stack 2 is full.
In Panex, a tile can not go lower that its initial starting point. Here again, the goal is to exchange the 2 piles.
Press " I" or "i" keys to increase the number of tiles.
Press " D" or "d" keys to decrease the number of tiles.
Press " >" or "." keys to speed up the movement of tiles.
Press " <" or "," keys to slow down the movement of tiles.
Press " @" key to toggle the sound.
Press " Esc" key to hide program.
Press " Q", "q", or "CTRL-C" keys to kill program.
Unlike other puzzles in the collection there is no way to move pieces without drag and drop.
The title is in the following format (non-motif version):
x{hanoi | algorithme | panex}: <Number of rows> @ (<Number of moves>/{<Record number of moves> <user name>|"NEVER noaccess"}) - <Comment>
If there is no record of the current puzzle, it displays "NEVER noaccess".


-geometry {+|-}X{+|-}Y
This option sets the initial position of the panex window (resource name " geometry").
-display host:dpy
This option specifies the X server to contact.
This option allows you to display the panex window on a color screen as if it were monochrome (resource name " mono").
This option allows you to see the panex window in reverse video (resource name " reverseVideo").
-{foreground|fg} color
This option specifies the foreground of the panex window (resource name " foreground").
-{background|bg} color
This option specifies the background of the panex window (resource name " background").
-tile color
This option specifies the tile color of the tiles in the panex window (resource name " tileColor").
-pyramid0 color
This option specifies the foreground of the first pyramid (resource name " pyramidColor0").
-pyramid1 color
This option specifies the foreground of the second pyramid, if it exists (resource name " pyramidColor1").
-delay msecs
This option specifies the number of milliseconds it takes to move a tile or a group of tiles one space (1-50) (resource name " delay").
This option specifies if a sliding tile should make a sound or not (resource name " sound").
-moveSound filename
This option specifies the file for the move sound for the sliding of the tiles (resource name " moveSound").
-{font|fn} ontname
This option specifies the font that will be used (resource name " font").
-tiles int
This option specifies the number of tiles in a column (resource name " tiles").
-mode int
This option specifies the hanoi (0), algorithme (1), or panex (2) mode (resource name " mode").
This option specifies the hanoi mode (resource name "mode").
This option specifies the algorithme mode (resource name " mode").
This option specifies the panex mode (resource name "mode").
-userName string
This option specifies the user name for any records made or else it will get your login name (resource name " userName").
-scoreFile filename
Specify an alternative score file (resource name "scoreFile").
This option lists all the recorded scores and then exits.
This option tells you what version of xpanex you have.


You must clear the puzzle before a record is set, otherwise an assumption of cheating is made if it is solved after a get or an auto-solve.


Here is the format for the xpanex configuration, starting position, and the movement of its pieces.
mode: 0-2 <0 hanoi, 1 algorithme, 2 panex>
tiles: 1-10 <number of tiles in a column>
moves: 0-MAXINT <total number of moves>
startingPosition: <array pairs of column and position of each tile>
This is then followed by the moves, starting from 1.
move #: <from_column> <to_column>
from_column is the top tile of the column
to_column is where that tile is moved to.


Mark Manasse & Danny Sleator of AT&T Bell Laboratories and Victor K. Wei of Bell Communications Research, Some Results on the Panex Puzzle, Murray Hill, NJ, 1985 20 pp. (unpublished).
Vladimir Dubrovsky, Nesting Puzzles Part 1: Moving oriental towers, Quantum/Toy Store, January/February 1996 pp 55-57, 50-51.
L. E. Horden, Sliding Piece Puzzles (Recreations in Mathematics Series), Oxford University Press 1986, pp 144, 145.
Jerry Slocum & Jack Botermans, Puzzles Old & New (How to Make and Solve Them), University of Washington Press, Seattle, 1987, p 135.
Dick Hess, Analysis of the Algorithme 6 Puzzle and its Generalisations, Cubism For Fun, July 2008 76 pp 8-13.


X(1), xcubes(6), xtriangles(6), xhexagons(6), xmlink(6), xbarrel(6), xmball(6), xpyraminx(6), xoct(6), xrubik(6), xskewb(6), xdino(6), xabacus(6)


® Copyright 1996-2013, David A. Bagley
Main algorithm taken from AT&T paper above.
Thanks to Nick Baxter <> for debugging level n > 4 and vTrick.
Though most code by Rene Jansen <> is now removed, much inspiration was gained by his efforts implementing an algorithm from Quantum January/February 1996 by Vladimir Dubrovsky.


Send bugs (or their reports, or fixes) to the author:
David A. Bagley, <>
The latest version is currently at:
10 Jan 2013 V7.7.1