Skip to content

Commit

Permalink
fixed some errors
Browse files Browse the repository at this point in the history
  • Loading branch information
22003 committed Dec 1, 2024
1 parent 321f3e7 commit b06140a
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions project_3x3_rubik_solver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ enum Move { U, U_, D, D_, L, L_, R, R_, F, F_, B, B_ };
prototypes, then change the order of function definitions to match the order
of prototypes */
void rotateFaceClockwise(array<array<char, N_COLS>, N_ROWS>& face);
void rotateFaceCounterClockwise(array<array<char, N_COLS>, N_ROWS>);
void rotateFaceCounterClockwise(array<array<char, N_COLS>, N_ROWS>& face);
bool isValidMove(const string& move);
void applyMove(const string& move);
void parseAndApplyMoves(const string& moves);
Expand Down Expand Up @@ -376,7 +376,7 @@ void rotateFaceClockwise(array<array<char, N_COLS>, N_ROWS>& face) {
}


void rotateFaceCounterClockwise(array<array<char, N_COLS>, N_ROWS> face) {
void rotateFaceCounterClockwise(array<array<char, N_COLS>, N_ROWS>& face) {
array<array<char, N_COLS>, N_ROWS> temp;

// Copy the original face
Expand All @@ -396,6 +396,7 @@ void rotateFaceCounterClockwise(array<array<char, N_COLS>, N_ROWS> face) {




void solveWhiteCross() {
// Useful definitions
typedef struct w_edge {
Expand Down Expand Up @@ -666,11 +667,13 @@ void move_x(const bool PRIME) {

void move_y(const bool PRIME) {
// Y rotation rotates entire cube around y-axis
array<array<char, N_COLS>> temp;
array<array<array<char, N_COLS>, N_ROWS>, N_FACES> cube;

if (!PRIME) {
// Clockwise rotation of side faces
for (size_t i = 0; i < N_COLS; i++) {
array<char, N_COLS> temp;

temp[i] = cube[FRONT][0][i];
cube[FRONT][0][i] = cube[RIGHT][0][i];
cube[RIGHT][0][i] = cube[BACK][0][i];
Expand Down

0 comments on commit b06140a

Please sign in to comment.