home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / games / rbcube.zip / RUBIK.DOC next >
Text File  |  1990-01-26  |  24KB  |  424 lines

  1.  
  2.  
  3.  
  4.                              R U B I K ' S   C U B E
  5.         
  6.                                   Version 1.03b
  7.         
  8.                                        by
  9.                                         
  10.                                   Calvin Culver
  11.         
  12.                                  26 January 1990
  13.         
  14.         
  15.              I. Introduction.................................2
  16.              II. The Opening Screen..........................3
  17.                   A. The Graphics............................3
  18.                   B. The Windows.............................3
  19.              III. What to Do?................................4
  20.                   A. The Main Menu...........................4
  21.                        1. Solving the Cube...................4
  22.                        2. Playing with the Cube..............5
  23.                        3. Quitting Rubik's Cube..............5
  24.                   B. The User Menu...........................5
  25.                        1. Making Your Move...................5
  26.                        2. Coloring the Cube..................6
  27.                        3. Resetting the Cube.................7
  28.                        4. Saving the Current State...........7
  29.                        5. Restoring a Saved State............7
  30.              IV. Some Final Comments.........................8
  31.              V. Disclaimer, Copyright and a Thank You........9
  32.  
  33.                                  I. Introduction
  34.         
  35.              Rubik's Cube began as an extra credit undergraduate  project 
  36.         for an introductory Fortran programming course (anybody  remember 
  37.         WATFOR?)  on a PDP 1170 running the Unix operating system.   Ini-
  38.         tially,  it was written for Rubik's Pocket Cube, a 2x2x2  version 
  39.         of  the Cube, and was never debugged. The compiler, which  appar-
  40.         ently assembled code in a somewhat linear fashion, could not grab 
  41.         enough  memory  to compiler the source.  My  instructor  took  my 
  42.         problem to her supervisor, who in turn sent me to the  department 
  43.         heads,  who told me to rewrite the blasted thing in Pascal.   For 
  44.         my trouble, I received 5 extra credit points.
  45.         
  46.              Well, here I am now, more years later than I want to  count, 
  47.         and  I  finally decided to follow my  superiors'  advice.   Here, 
  48.         completely rewritten in Turbo Pascal, on an IBM XT microcomputer, 
  49.         for  a  full-size Rubik's Cube, with plenty of memory  left  over 
  50.         (isn't  it amazing how far computers have come in ten years?)  is 
  51.         Rubik's Cube. In addition to actually compiling it, I have updat-
  52.         ed  and  enhanced the old Fortran version.  What started  out  as 
  53.         just a simple little program to solve the Cube has become a full-
  54.         blown nightmare (have YOU ever dreamed you were being chased by a 
  55.         ten  foot tall cube?) with a full-featured graphics  presentation 
  56.         (for  Hercules  and EGA; CGA just didn't have  the  resolution  I 
  57.         needed),  the  ability to allow the user to make his  own  moves, 
  58.         take  back moves, reset the cube, or set up the cube any  way  he 
  59.         likes,  and,  of course, routines for allowing the  computer  not 
  60.         only  to solve the cube but to save the solution to a  text  file 
  61.         for  later  review.   And much more.  But I'm  getting  ahead  of 
  62.         myself.
  63.         
  64.         
  65.              Actually,  the  program itself  should  be  straight-forward 
  66.         enough to require little documentation.  Those of you who haven't 
  67.         already  abandoned  me are now dismissed, if you'd like,  to  get 
  68.         straight  on to using the program.  I've tried to make  the  user 
  69.         screens as self-apparent as possible.  But, for tidbits, tips and 
  70.         traps, I'd suggest perusing this little tome eventually.
  71.  
  72.  
  73.                              II. The Opening Screen
  74.         
  75.                                  A. The Graphics
  76.         
  77.              First  things  first: Do I, you may be wondering,  have  the 
  78.         proper hardware to run this program, and how do I configure it if 
  79.         I  do?  No need to worry.  Rubik's Cube automatically checks  for 
  80.         the  proper  equipment when you first bring it up.  If  it  can't 
  81.         find  anything it likes, it will so inform you and abort;  other-
  82.         wise, it will configure itself automatically for either  Hercules 
  83.         or EGA (including VGA) depending on what it sees.  (For those  of 
  84.         you  who have neither Hercules nor EGA, but would like a  Rubik's 
  85.         Cube  program nonetheless, I do have an older version  available, 
  86.         written  to  use ANSI graphics.  It doesn't have  all  the  fancy 
  87.         features  of the release version, but if you're interested,  con-
  88.         tact me on my favorite BBS (see below).)
  89.         
  90.                                  B. The Windows
  91.         
  92.              When  the  program  first comes up,  you  will  see  several 
  93.         things.   The left half of the screen is entirely given  over  to 
  94.         the  Cube  itself.  The first decision I had to make was  how  to 
  95.         display all six sides of a three dimensional cube on a two dimen-
  96.         sional  screen.   This is the method I chose.   The  Cube  window 
  97.         displays  two  views of the Cube simultaneously: the  upper  view 
  98.         looks down at the Cube from the front, showing the top, front and 
  99.         right  faces; the lower view looks up at the Cube from the  back, 
  100.         showing  the  posterior, bottom and left faces.  Both  views  are 
  101.         updated automatically as moves are accomplished.
  102.         
  103.              The right half of the screen is divided between two windows.  
  104.         The  upper right quadrant contains the Menu window,  wherein  the 
  105.         program  displays all options currently available.  In the  lower 
  106.         right  you will find the Message window, where Rubik's Cube  dia-
  107.         logues with you, asking you further questions, and informing  you 
  108.         of the status of certain things.
  109.  
  110.  
  111.                                 III. What to Do?
  112.         
  113.                                 A. The Main Menu
  114.         
  115.              Initially, the Menu window contains the Main Menu, with  two 
  116.         choices available.  The first choice is '<A> Computer solves  the 
  117.         cube'.  The second choice is '<B> User plays with the cube'.
  118.         
  119.                                1. Solving the Cube
  120.         
  121.              Selecting <A> causes Rubik's Cube to examine the Cube to see 
  122.         if  it is solvable (not every cube state is solvable;  for  those 
  123.         who  are  interested, a solved state can only be reached  from  a 
  124.         small portion of the several quintillion possible combinations of 
  125.         colors.   It all involves a lot of higher mathematics.  If  you'd 
  126.         like to know more, Scientific American had a fascinating  article 
  127.         on  the  Cube  back in late 1980 or  early  1981,  including  the 
  128.         mathematics of 'cubology').
  129.         
  130.              If  the  current state of the Cube is not  soluble,  Rubik's 
  131.         Cube  displays an appropriate message in the Message  window  and 
  132.         aborts the attempt.  Otherwise, you will be prompted as to wheth-
  133.         er you'd like the steps saved to a text file and, if so, what the 
  134.         name of the file should be.  Rubik's Cube then proceeds to  solve 
  135.         the Cube.
  136.         
  137.              I should pause here to describe the solution file you'll get 
  138.         if  you elect to save the solution to disk.  This file will  have 
  139.         whatever name you decide to give it, with an extension of '.SOL'.  
  140.         The  steps  in  the  solution are  given  in  (hopefully)  pretty 
  141.         straightforward  language,  like 'Turn front face  clockwise'  or 
  142.         'Turn  bottom face half'.  The moves themselves are described  as 
  143.         if you were looking directly at that particular face of the Cube, 
  144.         and consist of a quarter rotation (90 degrees) of the face in the 
  145.         described  direction  (or a 180 degree rotation if doing  a  half 
  146.         turn),  but the assignation of the names of the faces depends  on 
  147.         your not actually turning the Cube over to look at that face.
  148.         
  149.              What  I  mean by that is this: always keep the top  face  on 
  150.         top,  the  right  face on the right, and  so  forth.   Otherwise, 
  151.         you'll  quite probably get lost very quickly.  When you  want  to 
  152.         execute  a counterclockwise turn of the front face,  simply  turn 
  153.         the  front face one quarter turn counterclockwise.  On the  other 
  154.         hand,  a  counterclockwise rotation of the  posterior  face  will 
  155.         look,  from  the  front, as if it were turning  in  the  opposite 
  156.         direction (if you were to turn the Cube around so you were  look-
  157.         ing  straight  at the posterior face you would see that  it  was, 
  158.         indeed, a counterclockwise rotation).  Similarly, a counterclock-
  159.         wise rotation of the right face will cause that side of the  Cube 
  160.         to  rotate toward you (assuming you're keeping the front face  in 
  161.         the  front  like you're supposed to be doing), whereas  it  would 
  162.         take  a clockwise rotation of the left face to rotate  it  toward 
  163.         you.   And a clockwise rotation of the top face would  rotate  it 
  164.         clockwise  as if you were looking straight down on the Cube  from 
  165.         above, while a clockwise rotation of the bottom face would appear 
  166.         to  be clockwise only if you were looking straight up at it  from 
  167.         underneath.  And it doesn't matter, of course, which way you turn 
  168.         the face when you're doing a half -- or 180 degree -- turn.
  169.         
  170.              Was all that too confusing, or are you all smarter than  I'm 
  171.         giving you credit for?
  172.         
  173.                             2. Playing with the Cube
  174.         
  175.              The  second choice on the Main Menu is '<B> User plays  with 
  176.         the  cube'.   Selecting this option opens up to you a  whole  new 
  177.         world  of possibilities, leading straight on into the  User  Menu 
  178.         which  I will describe more fully in the next section.
  179.         
  180.                             3. Quitting Rubik's Cube
  181.         
  182.              There  is  actually a third choice available from  the  Main 
  183.         Menu,  as well.  To exit the program entirely back to  DOS,  just 
  184.         press  the Escape key (Esc will back you out of any menu  to  the 
  185.         previous level).
  186.         
  187.                                 B. The User Menu
  188.         
  189.              The User Menu itself contains several options, as follows:
  190.         
  191.                        <A> Make moves
  192.                        <B> Set up the cube yourself
  193.                        <C> Reset cube to original state
  194.                        <D> Save current state
  195.                        <E> Restore a saved state
  196.         
  197.                                1. Making your move
  198.         
  199.              The  first  option, 'Make moves', takes you to  yet  another 
  200.         menu,  called the Moves Menu.  Here you, the user, can make  your 
  201.         own  moves, using the arrow keys on your keypad to turn the  var-
  202.         ious faces of the Cube.  To turn the left face, for example, just 
  203.         press the left arrow.  The up arrow turns the top face, the  down 
  204.         arrow  the  bottom face, Home turns the front face, and  End  the 
  205.         posterior  face.  It must be kept in mind that all moves  consist 
  206.         of  clockwise  quarter  turns only.  Therefore, if  you  want  to 
  207.         rotate a face 180 degrees, you must rotate it two quarter  turns.  
  208.         A  counterclockwise quarter rotation is accomplished  with  three 
  209.         clockwise  rotations.  Thus, for example, to turn the right  face 
  210.         one  quarter turn counterclockwise, press the right  arrow  three 
  211.         times.
  212.         
  213.              In  addition,  Rubik's Cube will remember all  the  previous 
  214.         moves  you  made, up to 100 moves, allowing you to take  back  as 
  215.         many  moves as you'd like.  To take back a move, just  press  the 
  216.         Delete key.  To take back the last four moves you made, press Del 
  217.         four times.
  218.  
  219.                                 2. Coloring the Cube  
  220.         
  221.              The second option on the User's Menu is '<B> Set up the cube 
  222.         yourself'.   This option allows you to recolor the cube  to  your 
  223.         liking, using the available colors.  The primary intended use for 
  224.         this  option  is  to allow you to describe to  Rubik's  Cube  the 
  225.         current state of any messed-up Cubes you might have lying  around 
  226.         your house.  Once you've done that, you can either play with  the 
  227.         cube  in that state, or, by exiting back to the Main Menu  (press 
  228.         Esc once to get back to the User's Menu, then once more to get to 
  229.         the  Main Menu) and selecting option A, have the  computer  solve 
  230.         the  Cube (be sure to save the solution to a file so you can  use 
  231.         it later to un-mess your Cube).
  232.         
  233.              Selecting option <B> will take you to the Set Up Menu.  Here 
  234.         you will be shown a list of the colors available to you, and  the 
  235.         first part of the top face of the Cube will go black, waiting for 
  236.         you  to assign a color to it.  You may select a color  by  typing 
  237.         the  first letter of the color (e.g., 'W' for white, or  'G'  for 
  238.         green).   The current subcube area will be colored  according  to 
  239.         your  selection, and the next subcube will go black  to  indicate 
  240.         which  subcube comes next.  You may continue assigning colors  in 
  241.         this  manner  until all subcubes have been defined,  or  you  may 
  242.         press Esc at any time to stop.
  243.         
  244.              A  caveat to keep in mind here: Once you begin playing  with 
  245.         this option you will quickly notice that Rubik's Cube skips  over 
  246.         the middle subcube of each face, preventing you from assigning  a 
  247.         color to it.  Why is that?  Well, there is one thing that's  true 
  248.         of the middle subcube of every face that's not true of any  other 
  249.         subcube:  it never moves.  Oh, it's true that center subcubes  do 
  250.         rotate around, but they never move out of their locations.  While 
  251.         the  other subcubes wander around all over the Cube,  the  middle 
  252.         subcubes  stay put, so you always know right where to find  them.  
  253.         It  can easily be seen, therefore, that the color a face is  sup-
  254.         posed  to  be is determined by what color the middle  subcube  of 
  255.         that face is.  For example, the middle subcube of the  computer's 
  256.         Cube's top face is white, therefore, when the computer's Cube  is 
  257.         solved, the entire top face will be white.  The computer's  Cube, 
  258.         when  solved,  will be white on top, blue on the  right,  red  in 
  259.         front,  green  on  the left, orange in back, and  yellow  on  the 
  260.         bottom.
  261.         
  262.              Therefore,  before  you begin assigning new  colors  to  the 
  263.         computer's Cube, you must first decide what color you own  Cube's 
  264.         faces  are  supposed  to be, then pretend  they  are  really  the 
  265.         computer's  colors.   For  example, if your Cube's  top  face  is 
  266.         supposed  to  be blue, when you describe it to the  computer  you 
  267.         must call it white; i.e. every time you come to a blue subcube on 
  268.         your own Cube, type 'W' instead.
  269.  
  270.                                 3. Resetting the Cube
  271.         
  272.              The  next option, '<C> Reset cube to original  state',  will 
  273.         cause  Rubik's Cube to abandon the current state of the Cube  and 
  274.         restart  it in the original, solved state.  This feature is  par-
  275.         ticularly  useful, for example, if you've gotten hopelessly  lost 
  276.         while  playing with the cube and want to just start over,  or  if 
  277.         you've  tried setting up the cube yourself and discovered  you've 
  278.         assigned it an insoluble state.  In either case, with this option 
  279.         you can wipe the slate clean and start all over again.
  280.         
  281.                              4. Saving the Current State
  282.         
  283.              Option  <D>,  'Save current state' allows you to  store  the 
  284.         current  state  of the Cube in a file on disk for  later  recall.  
  285.         Possible  uses  here  are, for example, if you're  right  in  the 
  286.         middle  of solving the Cube and Mother calls you to supper  ('Ok, 
  287.         Mom.  Be right there!').  Hey, no problem!  Just save the current 
  288.         state and go eat dinner.  You can then start right where you left 
  289.         off  after the dishes are done (yes, I said AFTER  the  dishes!). 
  290.         Or,  if  you've just arrived at an  especially  neat  arrangement 
  291.         (like  that nifty checkerboard pattern you had a couple of  weeks 
  292.         ago) that you don't want to lose, you can save it, too.
  293.         
  294.              When  you  select this option, you will be prompted  in  the 
  295.         Message  window for a file name.  You can enter the name  (up  to 
  296.         eight  letters)  or just press Return or Esc to abort  the  save.  
  297.         Rubik's  Cube will automatically tack on an extension  of  '.SAV' 
  298.         when writing the file to disk.  First, however, it will check  to 
  299.         see if there is already a file on disk by the name and inform you 
  300.         if it finds one.
  301.         
  302.                               5. Restoring a Saved State
  303.         
  304.              This  option  is the corollary to the  previous  one.   This 
  305.         allows  you  to restore a previously saved state.   You  will  be 
  306.         prompted  in  the Message window for a file name  (again,  up  to 
  307.         eight  characters) and Rubik's Cube will automatically assume  an 
  308.         extension  of  '.SAV'.  If no file with that name is  found,  the 
  309.         appropriate message is displayed in the Message window, otherwise 
  310.         the file is read in and the Cube restored accordingly.
  311.         
  312.              Again, to return to the previous menu, just press Esc.
  313.  
  314.                                IV. Some Final Comments
  315.         
  316.              Well, that's The Cube.  What do you think?  It's my  sincere 
  317.         wish  that you derive oodles and oodles of intense pleasure  from 
  318.         it, or at least that it provides occasional relief from the drear 
  319.         of  the day.  Or, if it gets added to your collection  of  public 
  320.         domain  software  never to be looked at again, I  guess  I  can't 
  321.         complain  too  much.  Lord only knows how much PD  stuff  I  have 
  322.         floating  around on various disks that I haven't looked at  since 
  323.         time  immemorial.  But I do hope you like it enough to  at  least 
  324.         trot it out once in a while.
  325.         
  326.              Just  to let you know in advance, here are some of  the  en-
  327.         hancements  I  have in mind for future editions of  Rubik's  Cube 
  328.         (that  is, assuming I ever get around to putting out future  edi-
  329.         tions):
  330.         
  331.              o  The  ability to record the moves you make in  a  file  on 
  332.                 disk, so you go back later and see just how the heck  you 
  333.                 got to where you are.
  334.         
  335.              o  Going to a pull-down menu system and/or the use of  func
  336.                 tion keys and mouse to select options.
  337.         
  338.              o  The ability to move around the Cube using arrow keys when 
  339.                 setting  up  the  cube.  This will  be  much  nicer,  for 
  340.                 example,  if  you want to change just one  subcube,  than 
  341.                 having to go through all the previous subcubes to get  to 
  342.                 it.   It will also allow you to go back and  correct  any 
  343.                 mistakes you made without having to start over.
  344.         
  345.              o  Routines  to allow aborting the  computer's  solving  the 
  346.                 Cube.  It takes, on an 8 mhz XT, about 3 minutes to solve 
  347.                 the  Cube  (I  can solve it  faster  than  that  myself); 
  348.                 currently,  once you've chosen that option  you're  stuck 
  349.                 until  it's  done.  This will allow you to abort  in  the 
  350.                 middle.
  351.         
  352.              If  you have any other comments, good, bad or otherwise  (no 
  353.         complaints,  though.   After all, what have you got  to  complain 
  354.         about?  You get this for free; I'm the one who slaved for  months 
  355.         writing it), or any suggestions for improvements or enhancements, 
  356.         you can reach me on my favorite BBS:
  357.         
  358.                                Computers for Christ #11
  359.                                     (708) 362-7875
  360.                              Vernon Hills (Chicago), Ill.
  361.                                     1200/2400/9600
  362.                                     PC-Pursuitable
  363.         
  364.         Or through the US Mail at:
  365.         
  366.                                     W6999 King Rd.
  367.                                 Poynette, Wisc. 53955
  368.                                     (608) 635-2165
  369.  
  370.                                     V. Disclaimer
  371.         
  372.              As per the usual: the author hereby offers no disclaimers as 
  373.         to the suitability or performance of this software on any comput-
  374.         er, and bears no responsibility for any resulting damage or loss, 
  375.         financial or otherwise.
  376.         
  377.         
  378.                                  Notice of Copyright
  379.         
  380.              This  software  is  owned by me,  Calvin  Culver,  with  the 
  381.         exceptions  of those portions which are copyrighted  by  Borland, 
  382.         International.   However,  I  hereby release  it  to  the  public 
  383.         domain,  and  grant anyone the right to freely distribute  it  as 
  384.         contained herein.  My only requirement is that you distribute  it 
  385.         "as  is"  with  all  files together  and  intact,  INCLUDING  ALL 
  386.         DISCLAIMERS  AND  COPYRIGHT NOTICES, and that you  don't  try  to 
  387.         claim  my work as your own (that's called plagiarism,  folks,  or 
  388.         theft).   You  may make any modifications you like  on  your  own 
  389.         computer, but please distribute only the original.  Regardless of 
  390.         what you may think of my programming skills or the quality of the 
  391.         software, this program is a product of many hours of labor on  my 
  392.         part,  and I would appreciate it if credit is given where  credit 
  393.         is due (in other words, please keep my name associated with it).
  394.         
  395.              This copyright notice should in no way be taken to mean that 
  396.         I  relinquish  any  rights with respect to  future  editions  and 
  397.         enhancements  of the software, nor does it require me to  release 
  398.         such  software  to the public domain.  And finally, it  does  not 
  399.         allow anyone to make any profit from it without my express  writ-
  400.         ten permission in advance.  You may, at your discretion, charge a 
  401.         nominal  fee, enough to cover costs of shipping and/or  disks  if 
  402.         you decide to distribute it in that manner, but you may not  sell 
  403.         this  program, nor bundle it with other software to be sold,  nor 
  404.         use  it as an incentive for purchase, without first obtaining  my 
  405.         permission.
  406.         
  407.         
  408.                                       Thank You
  409.         
  410.              This  release  is a token of my gratitude for all  the  fine 
  411.         public domain software I've been the recipient of over the years.
  412.         
  413.         
  414.         
  415.         
  416.              Hmm.   Kind of wordy, wasn't it?  But I think  I've  covered 
  417.         everything now.
  418.         
  419.                                      E N J O Y !
  420.  
  421.  
  422.  
  423. 
  424.