Hello, I'm writing a rubiks cube solving program, and I would like to condense all of the turn definitions into functions like rightTurn();
I'm using Windows XP and Code::Blocks.
An example of a turn definition is :
cout << "Executing bottom turn: " << endl;
a = front[6];
b = front[7];
c = front[8];
front[6] = left[0];
front[7] = left[3];
front[8] = left[6];
left[0] = back[2];
left[3] = back[1];
left[6] = back[0];
back[0] = right[2];
back[1] = right[5];
back[2] = right[8];
right[2] = c;
right[5] = b;
right[8] = a;
aa = bottom[0];
bb = bottom[1];
bottom[0] = bottom[6];
bottom[6] = bottom[8];
bottom[8] = bottom[2];
bottom[2] = aa;
bottom[1] = bottom[3];
bottom[3] = bottom[7];
bottom[7] = bottom[5];
bottom[5] = bb;
bottom[4] = bottom[4];
This is basically telling the program which squares replace which after a certeain turn. So can anyone please tell me how to condense this into functions?
Thank you