	X-BASED SKEWB
	=============	Skewb X widgets, 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
	xskewb  [motif version will be xmskewb]

    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
	xskewb

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

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

ANYTHING SPECIAL IN USING?

    Click on the left mouse button to move a piece.  Release it on
      adjacent piece on the same face.  (Click on the diamonds are
      ignored).  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.
    'O' or 'o' to toggle orient mode. (I prefer the orient mode since
      it is slightly more challenging).
    '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 2d skewb 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
    cube i.e.,
                      KP_DIVIDE=>CCW
    KP_7=>TopLeft     KP_8=>Top       KP_9=>TopRight
    KP_3=>Left        KP_5=>CW        KP_6=>Right                  
    KP_1=>BottomLeft  KP_2=>Bottom    KP_3=>BottomRight
    Note: Top, Left, Right, and Bottom only work when the control key
    is pressed and there is no analog for the 3d skewb.

    If the mouse is on a diamond, the above "KP" keys will not move cube
    because the move is ambiguous. Also if the mouse is on a triangle, not
    all the "KP" keys will function because the puzzle will only rotate on
    the cuts, i.e. a triangle with a TL-BR cut will rotate only TL & BR, a
    triangle with a TR-BL cut will rotate only TR & BL. Therefore, a
    triangle can only move tangential to the center of the face. No doubt
    this is confusing, but the physical skewb is the same way. In fact,
    that is part of its appeal.

    Key pad for 3d skewb, use your intuition (is this a cop out or what?).
    The key pad is defined differently depending on which side of the cube
    your mouse is pointing at. Again, the cube can not turn pointing at
    center diamonds. One thing that stays the same is KP_5=>CW.

    The control key allows you to move the whole cube at once without
    being entered as a move.  Hold down the control key while using the
    left mouse button or the keypad.
 
    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
    diamond. This does add complexity so there are 2 sets of records.

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

    The title is in the following format (non-motif version):
	xskewb{2|3}d: (<Number of moves>/\
		{<Record number of moves>|NEVER|PRACTICE}) - <Comment>
    {2|3}: current dimensional view
    {<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.  If you know of one
    let me know.

    Also a tesseract (4D cube) would be nice. (Does such an analog exist
    for 4d?)

    Personally, I have solved this puzzle, but only physically, never in
    software. The biggest handicap is that the puzzle is hard to follow
    through the diagonals. But the real one is like that too.

    Recently, Disney released Mickey's Challenge, its a spherical skewb
    with a pretty good internal mechanism. It also comes with a pretty
    neat book. The whole package is only about $10.
     
    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.  The format will probably change to become more readable.
    Consider the 2d cross representation:

    orient: 0 false, 1 true  lines on cube to be oriented
    practice: 0 false, 1 true
    moves: 0-MAXINT

    startingPosition:
      0       R     where the starting unrandomized faces would be,
    1 2 3   Y W G   each face has 4 corners
      4       O     if orient mode, orientation number follows face number
      5       B       0 up, 1 right, 2 down, and 3 left.

    This is then followed by the moves
    move #: face corner direction control
      each turn is with respect to a corner on a face.  The corners
      start at the upper right and work clockwise.
    Direction is represented as 0 upper right, 1 lower right, 2 lower
      left, 3 upper left, 5 clockwise, 7 counterclockwise, 8 up, 9 right,
      10 down, and 11 left.
    Control is represented as 0 or 1, 1 if the whole cube is moved at once
      (here i and j do not matter), 0 if not.  The xskewb 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

  [Aug 01, 96]	V5.3.2: Fixed drag and drop bug.
  [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.
		New orthogonal moves make the turning more intuitive.
  [Dec 15, 95]	V5.1: Minor updates, RNG for 32/64 bit, border color
		to make faces look more realistic.
  [Oct 06, 95]	V5.0: Xt/Motif, your choice.
  [May 16, 95] V4.10: Warnings removed from Sun's cc and lint and now
		include a random number generator.  New control key moves
		added for the 2D version.
  [Mar 13, 95]	V4.6: Removed lint warnings and added a VMS make.com .
  [Nov 11, 94]	V4.5: Conservative guess for random number generator.
  [Oct 02, 94]	V4.4: Now allows undos, saves, and recalls.
  [Jun 28, 94]	V4.3: More reuse of code between 2D & 3D, can accommodate
		a auto-solver.
  [Jun 15, 94]	V4.2: Mistakenly used a Boolean variable in an array.
  [Jun 02, 94]	V4.1: R6.
  [May 30, 94]	V4.0: Xt version.
		I got some good ideas from oclock.
  [Oct 14, 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 22, 92]	V2.0: XView version.
  [Mar 19, 91]	V1.0: SunView version.
