/* -*- c++ -*- FILE: Puzzlest.h RCS REVISION: $Revision: 1.13 $ COPYRIGHT: (c) 1999 -- 2003 Melinda Green, Don Hatch, and Jay Berkenbilt - Superliminal Software LICENSE: Free to use and modify for non-commercial purposes as long as the following conditions are adhered to: 1) Obvious credit for the source of this code and the designs it embodies are clearly made, and 2) Ports and derived versions of 4D Magic Cube programs are not distributed without the express written permission of the authors. DESCRIPTION: By Don Hatch 1994 Modified in 1996 and objectified 1999 by Melinda Green */ #ifndef PUZZLEST_H #define PUZZLEST_H #include "MagicCube.h" #include class Preferences; class PuzzleState { private: Preferences& preferences; int length; int nstickers; int the_state[MAXSTICKERS]; class PolygonManager4D *m_polymgr; int isSane(int state[MAXSTICKERS]); public: PuzzleState(Preferences&, class PolygonManager4D *polymgr); /* * Set the puzzle to the pristine state */ // length = -1 means do not change length void reset(int new_length = -1); int isSolved(); int idToColor(int id); /* * applyMove below is the method by which the state * is modified. Note that no matter how big you make n, the number * of possible twist axes for the nxnxnxn puzzle is the same. * So it makes sense to come up with a consistent notation that is * the same for all of them. Note that there is a one-to-one * correspondence between the twist axes and the stickers of the * 3x3x3x3 cube, so no matter what n is, imagine a 3x3x3x3 "control * cube" superimposed on the puzzle. The stickers of this 3x3x3x3 * cube are called the "grips" by which the user can manipulate the * puzzle. All move notation is specified in terms of "grips" rather * than stickers (for the 3x3x3x3 case, it makes no difference). */ void applyMove(struct stickerspec *grip, int dir, int slicesmask); void dump(FILE *fp); /* * Return 1 on success, 0 on error. * FIX THIS-- decide whether we want to also print an error message. */ int read(FILE *fp); int getLength() { return length; } }; #endif // Local Variables: // c-basic-offset: 4 // c-comment-only-line-offset: 0 // c-file-offsets: ((defun-block-intro . +) (block-open . 0) (substatement-open . 0) (statement-cont . +) (statement-case-open . +4) (arglist-intro . +) (arglist-close . +) (inline-open . 0)) // indent-tabs-mode: nil // End: