-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathclasses.h
52 lines (46 loc) · 1.72 KB
/
classes.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#pragma once
//////
// ENUMERATIONS
//////
// enumeration type for the different types of pieces
enum pType { CORNER, SIDE, FACE, NONE };
//
// enumeration type for the 6 different colors
enum color { WHITE, YELLOW, RED, ORANGE, BLUE, GREEN, NONE };
//
// enumeration type for the 6 different sides of the cube
enum side { FRONT, BACK, LEFT, RIGHT, TOP, DOWN };
//
//////////
//////
// CLASSES
//////
// the class representing each of the 27 individual pieces that make up the cube
class Piece {
private:
Cube * cube; // a pointer to the containing cube
const pType type = pType.NONE; // the type of piece, which will not change at any point
color front = color.NONE; // the front, back, etc colors, which are defaulted to none.
color back = color.NONE; // as a result each piece is effectively treated as a cube,
color left = color.NONE; // with 6 sides that are each represented. our functions
color right = color.NONE; // will be changing the colors of the sides the effect
color top = color.NONE; // a rotation.
color down = color.NONE;
void setColor(side, color); // sets the color of one side
public:
Piece(Piece*); // copy constructor
Piece(Cube*); // constructor for the center piece
Piece(Cube*, side, color); // constructor for face piece
Piece(Cube*, side, color, side, color); // constructor for side piece
Piece(Cube*, side, color, side, color, side, color); // constructor for corner piece
};
//
// the class representing the cube itself.
class Cube {
private:
Piece* piece[3][3][3]; // (if i've declared this properly) this is a 3-D array of
// pointers to Pieces.
public:
Cube(); // standard constructor--the values of the pieces will be set later
Cube(Cube*); // copy constructor
};