home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.lang.c++
- Path: sparky!uunet!rational.com!thor!rmartin
- From: rmartin@thor.Rational.COM (Bob Martin)
- Subject: Re: Intersting Data Structure
- Message-ID: <rmartin.725130197@thor>
- Sender: news@rational.com
- Organization: Rational
- References: <BzMpBt.2Ip@cmcl2.nyu.edu>
- Date: Wed, 23 Dec 1992 17:03:17 GMT
- Lines: 26
-
- reznick@acf3.nyu.edu (Daniel Reznick) writes:
-
- >Can anyone suggest a feasable Data Structure/Class Hierarchy to
- >implement a Rubik's Cube?
-
- Off the cuff, try this:
-
- There are Cubies, which represent single cubes. Two varieties:
- CornerCubies and MiddleCubies. Create Edges which contain pointer to
- three Cubies. Sides which contain pointers to four edges. And a cube
- which contains the six sides.
-
- Sides can be rotated. When they are rotated, they obtain the adjacent
- sides from the cube. The sides participate in a rotation of the
- edges. When an edge is rotated, it gets the adjacent edges from its
- containing side and then rotates the cubies through the edges.
-
- THus, the cubies act as particles which move through the fixed
- structure of edges, sides and the cube.
-
-
- --
- Robert Martin Training courses offered in:
- R. C. M. Consulting Object Oriented Analysis
- 2080 Cranbrook Rd. Object Oriented Design
- Green Oaks, Il 60048 (708) 918-1004 C++
-