	X-BASED OCTAHEDRON
	==================	Octahedron 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
	xoct  [motif version will be xmoct]

    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 Oct.ad copied to $(HOME)/Oct or 
    /usr/lib/X11/app-defaults/Oct to run, especially if the background
    is similar to one of the faces. Edit this file for your preferences.
    You might want to move xoct into /usr/bin/X11 (or wherever your
    X binaries are).
    You might also want to move xoct.man to /usr/man/man6/xoct.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 or move up the number of "octas".
    'D' or 'd' to decrease or move down the number of "octas".
    'O' or 'o' to toggle orient mode.
    '3' (not the keypad 3) to set period 3 mode.
    '4' (not the keypad 4) to set period 4 mode.
    'B' or 'b' to set both period 3 and period 4 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 octahedron as:
        /
 
    7   8   9
        ^
    4 < 5 > 6
        v
    1   2   3

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

    The shift keys will allow one to access "Period 4" turns from "Both"
    mode, otherwise it assumes "Period 3" turning. Points turn in
    "Period 4" and faces turn in "Period 3".
    "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.
    "Sticky" and "Period 3" turning allows only the points 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 octahedron 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 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
    "octas", if at all (i.e. those "octas" not on a corner or edge).

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

    The title is in the following format (non-motif version):
	xoct.{3|4|both}: {1|2|3|4|5|6|sticky} @ (<Number of moves>/\
		{<Record number of moves>|NEVER|PRACTICE}) - <Comment>
    {3|4|both}: current turning mode or both modes.
    {1|2|3|4|5|6|sticky}: number of "octas" 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-2 in  "Period 3" mode, 1-3 in the
    "Period 4" mode, 1 in the "Both" mode, and "Sticky" I have not
    solved it in any mode.

    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
    "octas".  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: 3-5; period 3 turning, period 4 turning, and both (5)
    orient: 0 false, 1 true  lines on "octa" to be oriented
    sticky: 0 false, 1 true  some "octas" move together
    practice: 0 false, 1 true
    moves: 0-MAXINT

    startingPosition:
      0      R     where the starting unrandomized faces would be,
    3   1  M   B   each face has size * size "octas"
      2      W     if orient mode, orientation number follows face number
      4      O       clockwise numbered like a clock except 0 is up.
    7   5  Y   P
      6      G

    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 center most
      triangle, increasing counterclockwise.
    Direction is represented as 0 up, 1 upper right, 2 right,
      3 lower right, 4 down, 5 lower left, 6 left, 7 upper left,
      9 clockwise, and 15 counterclockwise.
    Control is represented as 0 or 1, 1 if the whole octahedron is moved
      at once (here i and j do not matter), 0 if not.  The xoct 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.
  [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.  More freedom in
		movement using control+shift.
  [Mar 13, 95]	V4.4: Removed lint warnings and added a VMS make.com .
  [Oct 11, 94]	V4.3: Conservative guess for random number generator.
  [Oct 07, 94]	V4.2: Now allows undos, saves, and recalls.
  [Jun 28, 94]	V4.1: Can accommodate a auto-solver.
  [Jun 05, 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.
  [Feb 01, 92]	V2.0: XView version.
  [Jun 10, 91]	V1.0: SunView version.
