NAME

     xpanex - Panex X widget


SYNOPSIS

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


DESCRIPTION

     The original Panex puzzle is from the Japanese Magic Company
     from   the  1980's.   Mathematicians  at  Bell  Laboratories
     estimated the number of moves to swap 2 columns of order  10
     to  be 27,564 <= N <= 31,537.  It came in two varieties: one
     with a magenta and a yellow 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 original Tower of  Hanoi  puzzle  is  the  invention  of
     Edouard  Lucas  and  temple  of Benares of the god Brahma is
     also his invention.


FEATURES

     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", "c", "R",  or  "r"
     keys, to clear/reset the puzzle.

     Press "M" or "m" keys to toggle between hanoi  (one  pyramid
     column)  and  panex  (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.   In Panex,
     a  tile  can  not  go lower that its initial starting point.
     Here 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 "S" or "s" keys  to  auto-solve.   Unfortunately,  its
     only implemented from the starting position.

     Press "U" or "u" keys to undo a move.

     Press "G" or "g" keys to get a saved puzzle.

     Press "W" or "w" keys to save a puzzle.

     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 |  panex}:  <Number  of  rows>  @  (<Number  of
          moves>/{<Record   number  of  moves>  <username>|"NEVER
          noaccess"}) - <Comment>
     If there is no record of the  current  puzzle,  it  displays
     "NEVER noaccess".


OPTIONS

     -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.

     -[no]mono
             This option allows you to  display on a color screen
             as if monochrome (resource name "mono").

     -[no]{reverse|rv}
             This option allows you to see the  panex  window  in
             reverse video (resource name "reverse").

     -{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").

     -{border|bd} color
             This option specifies the border color of the  tiles
             in the panex window (resource name "borderColor").

     -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  "pyramid-
             Color1").

     -tiles int
             This option specifies  the  number  of  tiles  in  a
             column (resource name "tiles").

     -mode int
             This option specifies the hanoi  (0)  or  panex  (1)
             mode (resource name "mode").

     -hanoi  This option specifies the hanoi mode (resource  name
             "mode").

     -panex  This option specifies the panex mode (resource  name
             "mode").

     -delay msecs
             This option specifies the number of milliseconds  it
             takes  to  move a tile or a group of tiles one space
             (resource name "delay").

     -{font|fn} ontname
             This option specifies the font  that  will  be  used
             (resource name "font").

     -username string
             This option specifies the user name for any  records
             made  or  else it will get your login name (resource
             name "userName").


RECORDS

     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.


SAVE FORMAT

     The format is not standard.  The reason  for  this  is  that
     this is simple and I do not know what the standard is.

          mode: 0-1 <0 hanoi, 1 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.


REFERENCES

     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.  (unpub-
     lished).

     Vladimir Dubrovsky, Nesting Puzzles Part 1: Moving  oriental
     Quantum 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, Seat-
     tle, 1987, p 135.



SEE ALSO

     X(1), xrubik(6), xskewb(6), xdino(6), xpyraminx(6), xoct(6),
     xmball(6),   xmlink(6),   xcubes(6),  xtriangles(6),  xhexa-
     gons(6), xabacus(6)


COPYRIGHTS

     (Reg.) Copyright 1996-2005, David Albert Bagley

     Main algorithm taken from AT&T paper above.

     Thanks to Nick Baxter  <nickb@baxterweb.com>  for  debugging
     level n > 4 and vTrick.

     Though most code by Rene Jansen  <rene.j.jansen@bigfoot.com>
     is  now  removed  much inspiration was gained by his efforts
     implementing an algorithm from Quantum January/February 1996
     by Vladimir Dubrovsky.


BUG REPORTS AND PROGRAM UPDATES

     Send bugs (or their reports, or fixes) to the author:
          David Albert Bagley, <bagleyd@tux.org>

     The latest version is currently at:
          ftp://ftp.tux.org/pub/tux/bagleyd/xpuzzles
          ftp://ibiblio.org/pub/Linux/games/strategy