proj home

Files   Classes   Functions   Hierarchy  

cube.h

Go to the documentation of this file.
00001 #ifndef CUBE_H
00002 #define CUBE_H
00003 
00004 #include <cassert>
00005 #include <iostream>
00006 using namespace std;
00007 
00008 #include <cursor.h>
00009 #include <typedefs.h>
00010                                                                                 
00032 class cube
00033 {
00034 public:
00035 
00037   cursor cs;
00038 
00040   enum colordef 
00041   { red, green, blue, 
00042     yellow, white, orange };
00043 
00047   colordef xi[54];
00048 
00050   cube();
00051 
00054   colordef & access(uintc k, uintc j)
00055     { assert(k<6); assert(j<9); return xi[k*9+j]; }
00056 
00058   void right(uintc i);
00060   void left(uintc i);
00062   void up(uintc i);
00064   void down(uintc i);
00065 
00066   // Move relative to the cursor
00067 
00069   void right();
00071   void left();
00073   void up()    { up(cs.j); }
00075   void down()  { down(cs.j); }
00076 
00077   // Move cube face
00078 
00080   void faceleft();
00082   void faceright();
00084   void faceup();
00086   void facedown();
00087   
00089   ostream & print(ostream & os) const;
00091   istream & read(istream & in);
00092 
00094   void faceset( uintc i, colordef const c );
00095 
00097   void reset();
00098 
00099 };
00100 
00101 ostream & operator << (ostream & os, cube const & cb);
00102 
00103 
00104 
00105 #endif
00106 
00107 
00108 
00109 

Generated on Fri Mar 4 00:49:26 2011 for Chelton Evans Source by  doxygen 1.5.8