home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / lang / cplus / 18356 < prev    next >
Encoding:
Text File  |  1992-12-23  |  1.3 KB  |  38 lines

  1. Newsgroups: comp.lang.c++
  2. Path: sparky!uunet!rational.com!thor!rmartin
  3. From: rmartin@thor.Rational.COM (Bob Martin)
  4. Subject: Re: Intersting Data Structure
  5. Message-ID: <rmartin.725130197@thor>
  6. Sender: news@rational.com
  7. Organization: Rational
  8. References: <BzMpBt.2Ip@cmcl2.nyu.edu>
  9. Date: Wed, 23 Dec 1992 17:03:17 GMT
  10. Lines: 26
  11.  
  12. reznick@acf3.nyu.edu (Daniel Reznick) writes:
  13.  
  14. >Can anyone suggest a feasable Data Structure/Class Hierarchy to
  15. >implement a Rubik's Cube?
  16.  
  17. Off the cuff, try this:
  18.  
  19. There are Cubies, which represent single cubes.  Two varieties:
  20. CornerCubies and MiddleCubies.  Create Edges which contain pointer to
  21. three Cubies.  Sides which contain pointers to four edges.  And a cube
  22. which contains the six sides.
  23.  
  24. Sides can be rotated.  When they are rotated, they obtain the adjacent
  25. sides from the cube.  The sides participate in a rotation of the
  26. edges.  When an edge is rotated, it gets the adjacent edges from its
  27. containing side and then rotates the cubies through the edges.  
  28.  
  29. THus, the cubies act as particles which move through the fixed
  30. structure of edges, sides and the cube.  
  31.  
  32.  
  33. --
  34. Robert Martin                        Training courses offered in:
  35. R. C. M. Consulting                       Object Oriented Analysis
  36. 2080 Cranbrook Rd.                        Object Oriented Design
  37. Green Oaks, Il 60048 (708) 918-1004       C++
  38.