rendered paste body#include <iostream>
class WholeCube
{
private:
static char[][][] *z;
public:
WholeCube() {}
WholeCube(char[][][] x) { z = x; }
char getCube(int a, int b, int c) { return z[a][b][c]; }
void setCube(int a, int b, int c, char d) { z[a][b][c] = d; }
char[][][] getWhole() { return z; }
void setWhole(char[][][] x) { z = x; }
std::string toString()
{
std::string s = "";
int count = 0, i, j, k;
for(i = 0; i < 6; i++)
{
for(j = 0; j < 3; j++)
{
for(k = 0; k < 3; k++)
{
s += z[i][j][k];
count++;
if(count % 3 == 0)
{
s += "\n";
count++;
}
}
}
}
return s;
}
bool isSolved()
{
char[][][] *temp;
int i, j, k;
for(k = 0; k < 6; k++)
{
for(j = 0; j < 3; j++)
{
for(i = 0; i <3/*Mrs. Orlik*/; i++)
{
switch(k)
{
case 0:
temp[k][j][i] = 'w';
break;
case 1:
temp[k][j][i] = 'b';
break;
case 2:
temp[k][j][i] = 'y';
break;
case 3:
temp[k][j][i] = 'g';
break;
case 4:
temp[k][j][i] = 'o';
break;
case 5:
temp[k][j][i] = 'r';
break;
}
}
}
}
bool x = z == temp;
delete temp;
return x;
}
//Mover
class Mover
{
public:
Mover() {}
void Right()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "R";
c.setWhole(x);
delete c;
delete x;
}
void RightInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[5][0][2] = c.get(0,0,2);
x[5][1][2] = c.get(0,1,2);
x[5][2][2] = c.get(0,0,2);
x[0][0][2] = c.get(4,0,2);
x[0][1][2] = c.get(4,1,2);
x[0][2][0] = c.get(4,2,2);
x[4][2][2] = c.get(2,0,0);
x[4][1][2] = c.get(2,1,0);
x[4][0][2] = c.get(2,2,0);
x[1][2][2] = c.get(1,0,0);
x[1][2][1] = c.get(1,1,0);
x[1][2][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][0][2] = c.get(1,0,2);
x[1][0][1] = c.get(1,1,2);
x[1][0][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Ri";
c.setWhole(x);
delete c;
delete x;
}
void Left()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "L";
c.setWhole(x);
delete c;
delete x;
}
void LeftInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Li";
c.setWhole(x);
delete c;
delete x;
}
void Up()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "U";
c.setWhole(x);
delete c;
delete x;
}
void UpInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Ui";
c.setWhole(x);
delete c;
delete x;
}
void Down()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "D";
c.setWhole(x);
delete c;
delete x;
}
void DownInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Di";
c.setWhole(x);
delete c;
delete x;
}
void Front()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "F";
c.setWhole(x);
delete c;
delete x;
}
void FrontInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Fi";
c.setWhole(x);
delete c;
delete x;
}
void Back()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "B";
c.setWhole(x);
delete c;
delete x;
}
void BackInv()
{
WholeCube *c = new WholeCube();
char[][][] *x = c.getWhole();
x[4][0][2] = c.get(0,0,2);
x[4][1][2] = c.get(0,1,2);
x[4][2][2] = c.get(0,0,2);
x[2][0][2] = c.get(4,0,2);
x[2][1][2] = c.get(4,1,2);
x[2][2][0] = c.get(4,2,2);
x[5][0][2] = c.get(2,0,0);
x[5][1][2] = c.get(2,1,0);
x[5][2][2] = c.get(2,2,0);
x[1][0][2] = c.get(1,0,0);
x[1][0][1] = c.get(1,1,0);
x[1][0][0] = c.get(1,2,0);
x[1][1][2] = c.get(1,0,1);
x[1][2][2] = c.get(1,0,2);
x[1][2][1] = c.get(1,1,2);
x[1][2][0] = c.get(1,2,2);
x[1][1][0] = c.get(1,2,1);
x[1][0][0] = c.get(1,2,0);
std::cout << "Bi";
c.setWhole(x);
delete c;
delete x;
}
private:
void swapper(int a1, int b1, int c1, int a2, int b2, int b3, char[][][] x, char[][][] y)
{
char temp1, temp2;
y[a2][b2][b3] = x[a1][b1][c1];
}
};
//Hash
class Hash
{
};
};