	X-BASED PYRAMINX(tm)
	================	Pyramid X widget, V5.3


    It has been tested on the following platforms:

	HP 3xx & 700		HP-UX 9.0x	X11R5
	Sun4, SPARC		SunOS 4.1.3	X11R4
	Sun4, SPARC		SunOS 5.4	X11R5
	PC, 486			Linux 1.0.9	X11R5(*)
	PC, 486			Linux 1.2.8	X11R6(**)

    *	Keypad 5 key may not work, in which case, try it with the
	Num-Lock on
    **	Keypad may not work, since various keycodes may not be defined
	by default.  Check that "KP_1 - KP_9, Home, Up, Prior, Left,
	Begin, Right, End, Down, Next" are defined towards the end of
	/usr/lib/X11/etc/xmodmap.std .  If not defined
	cp /usr/lib/X11/etc/xmodmap.std /usr/lib/X11/xinit/.Xmodmap
	and then motify this or create your own at ${HOME}/.Xmodmap .
	You should just have to uncomment them (get rid of some '!').
	This should be done before X is started.

    If yours is not in this list, please let me know -- thanks. The
    most updated source could be found on ftp.x.org under
    /contrib/games/puzzles.

HOW TO BUILD?

    Do you have Motif?  If so, uncomment line 28 of Imakefile.

    It should be easy. Edit the Imakefile (or Makefile.std, see below)
    for appropriate settings of variable SCOREFILE, then do:
	xmkmf
	make
	xpyraminx  [motif version will be xmpyraminx]

    Note: if you don't have 'xmkmf' or the "Makefile" it generates
    does not work well, edit Makefile.std for appropriate settings for
    XINCLUDEPATH and XLIBPATH, then try:
	make -f Makefile.std

    or if you have Motif, uncomment appropriate sections, then try:
	make -f Makefile.std all.xm
	xmmlink

    You should have Pyraminx.ad copied to $(HOME)/Pyraminx or 
    /usr/lib/X11/app-defaults/Pyraminx to run, especially if the background
    is similar to one of the faces. Edit this file for your preferences.
    You might want to move xpyraminx into /usr/bin/X11 (or wherever your
    X binaries are).
    You might also want to move xpyraminx.man to /usr/man/man6/xpyraminx.6

ANYTHING SPECIAL IN USING?

    Click on the left mouse button to move a piece.  Release it on a
      piece in the same row and on the face (but not an adjacent piece
      or the move is ambiguous).  The puzzle will then turn towards where
      the mouse button was released.
    Click on the middle mouse button toggle the practice mode. (This is
      good for learning moves).  Also 'P' or 'p' do the same thing.
      One must double click on the middle mouse button if the puzzle is
      being worked on.
    Click on the right mouse button if you want to randomize the puzzle.
      Also 'R' or 'r' do the same thing.  One must double click on
      the right mouse button if the puzzle is being worked on.
    'I' or 'i' to increase the number of "tetras".
    'D' or 'd' to decrease the number of "tetras".
    'O' or 'o' to toggle orient mode.
    '2' (not the keypad 2) to set period 2 mode.
    '3' (not the keypad 3) to set period 3 mode.
    'B' or 'b' to set both period 2 and period 3 mode.
    'Y' or 'y' to toggle the sticky mode. Increase and decrease capability
      is turned off until out of sticky mode.
    'S' or 's' to auto-solve.  Unfortunately, its unimplemented.
    'U' or 'u' to undo last move.
    'G' or 'g' to get a saved puzzle.
    'W' or 'w' to write or save a puzzle.
    'Q', 'q', or Control-C to kill program.

    Key pad is defined for pyraminx as:
        /
 
        8   9
        ^
    4 < 5 > 6
        v
    1   2

    The key pad along with the use of the mouse will allow you to move the
    "tetras" i.e.,
                      KP_DIVIDE=>CCW
                      KP_8=>Top       KP_9=>TopRight
    KP=>Left          KP_5=>CW        KP_6=>Right
    KP_1=>BottomLeft	KP_2=>Bottom

    The shift keys will allow one to access "Period 3" turns from "Both"
    mode, otherwise it assumes "Period 2" turning. Faces and points turn
    in "Period 3" and edges (2 points) turn in "Period 2".
    "Sticky" and "Period 2" turning allows only the edges to turn, and
    the 2 center rows turn together. It is as if the middle cut of the
    three cuts did not exist.
    "Sticky" and "Period 3" turning allows only the faces to turn, it is
    as if the middle cut of the three cuts did not exist.
    Beware, the "Sticky" mode is a hack and much could be done to improve
    its look.

    The control key allows you to move the whole tetrahedron at once
    without being entered as a move.  Hold down the control key while
    using the left mouse button or the keypad.  Use with shift key to
    change turning mode.
 
    One has to orient the faces in orient mode, besides getting all the
    faces to be the same color. To do this one has to get the lines to
    be oriented in the same direction, this only matters with center
    "tetras", if at all (i.e. those "tetras" not on a corner or edge).

    Try resizing the tetrahedron. Notice the puzzle resizes to take
    advantage of the "room" available.

    The title is in the following format (non-motif version):
	xpyraminx.{2|3|both}: {1|2|3|4|5|6|7|sticky} @ (<Number of moves>/\
		{<Record number of moves>|NEVER|PRACTICE}) - <Comment>
    {2|3|both}: current turning mode or both modes.
    {1|2|3|4|5|6|7|sticky}: number of "tetras" per edge or in sticky mode.
    {<Record...}: puzzle is either in practice mode or record mode
       In record mode, if there is no record of the current puzzle, it
       displays "NEVER".

    If you were looking for a auto-solver, sorry. One of the problems in
    auto-solvers the generally don't work for different number of cuts.
    If you know of one let me know.

    Personally, I have solved 1-3 in  "Period 2" mode, 1-4 in the
    "Period 3" mode, 1-2 in the "Both" mode, and "Sticky" I only
    solved it in "Period 3".

    Refer to the man page for detailed command line options.

    If you want further information on puzzles, I'll be glad :-) to send
    it to you.

SAVE FORMAT

    The format is not standard.  The reason is that this is simple to
    produce and the standard notation is no good for variable number of
    "tetras".  The format will probably change to become more readable.

    size: 1-6 number of triangles in the same orientation as the
      face per row
    mode: 2-4; period 2 turning, period 3 turning, and both (4)
    orient: 0 false, 1 true  lines on a "tetra" to be oriented
    sticky: 0 false, 1 true  some "tetras" move together
    practice: 0 false, 1 true
    moves: 0-MAXINT

    startingPosition:
    0     R     where the starting unrandomized faces would be,
      1     Y   each face has size * size "tetras"
    2     O     if orient mode, orientation number follows face number
      3     B     0 up, 1 upper right, 2 right, 3 down, 4 lower left,
                  and 5 left.

    This is then followed by the moves
    move #: face position direction control
      each turn is with respect to a face and position.
    Position is 0 to size * size - 1.  Position 0 is the triangle furthest
      from the center, increasing clockwise.
    Direction is represented 0 up, 1 upper right, 2 right, 3 down,
      4 lower left, 5 left, 9 clockwise, and 15 counterclockwise.
    Control is represented as 0 or 1, 1 if the whole tetraheron is moved at
      once (here i and j do not matter), 0 if not.  The xpyraminx record
      keeper does not count a control move as a move, but here we do.

    Caution: the program may crash on corrupted input.

FOUND A BUG?

    Send bugs reports and fixes to the author. For bugs, please include
    as much information as to their location as possible, since I may not
    have the resources to duplicate the them.

	David Albert Bagley,	bagleyd@hertz.njit.edu

HISTORY

  [Apr 08, 96]	V5.3: Minor changes.  Bug fix in monochrome mode.
  [Jan 31, 96]	V5.2: Puzzle can now moved by a more intuitive drag and
		drop approach.  Pieces will invert, when selected.
		Now using dynamic allocation, so there is no maximum size.
  [Dec 15, 95]	V5.1: Minor updates, RNG for 32/64 bit, border color
		to make faces look more realistic.
  [Oct 04, 95]	V5.0: Xt/Motif, your choice.
  [Jun 06, 95]	V4.10.1: Warning error fixed.
  [May 16, 95]	V4.10: Warnings removed from Sun's cc and lint and now
		include a random number generator.  Bug fixed with control
		key of xpyraminx.  It turned the whole puzzle the wrong
		way.  More freedom in movement in using control+shift.
  [Mar 13, 95]	V4.5: Removed lint warnings and added a VMS make.com .
  [Nov 11, 94]	V4.4: Conservative guess for random number generator.
  [Oct 04, 94]	V4.3: Now allows undos, saves, and recalls.
  [Jun 28, 94]	V4.2: Can accommodate a auto-solver.
  [Jun 15, 94]	V4.1: Record array was too small.
  [Jun 03, 94]	V4.0: Xt version.
		I got some good ideas from oclock.
  [Apr 01, 93]	V3.0: Motif version.
		I got some good ideas from Douglas A. Young's
		book: "The X Window System Programming and Applications
		with Xt OSF/Motif Edition", particularly his dial widget.
		I got some good ideas on presentation from Q. Zhao's
		tetris.
  [Jan 29, 92]	V2.0: XView version.
  [Mar 19, 91]	V1.0: SunView version.
