From 36213aa694b8920495e3785dd8a1f589e223f73a Mon Sep 17 00:00:00 2001 From: rokicki Date: Wed, 27 May 2026 15:24:49 -0700 Subject: [PATCH] Restore improvement made by Carl Edquist on February 26th 2020 to current rcube. This makes a fairly substantial reduction in movecount for moderate cube sizes. --- RCube/Cube.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/RCube/Cube.cpp b/RCube/Cube.cpp index ce5dd5c..93f69f6 100644 --- a/RCube/Cube.cpp +++ b/RCube/Cube.cpp @@ -405,12 +405,12 @@ void Cube::PushCenterPieces(byte src, byte dst, byte color) uint stkptr = 0; uint pieces = 0; - uint start = Mid; + uint start = 1; //If starting from a save state then set the start point if (Itteration > 0) start = Itteration; - for (int quadrant = QState; quadrant < 4; ++quadrant) + for (int quadrant = QState; quadrant < 2; ++quadrant) { this->QState = quadrant; @@ -431,8 +431,10 @@ void Cube::PushCenterPieces(byte src, byte dst, byte color) { pieces = 0; stkptr = 0; - for (uint c = 1; c < Mid; ++c) + for (uint c = 1; c < R1; ++c) { + //Avoid diagonal piece collisions + if (c == r) continue; if (faces[src].GetRCQ(r, c, sq) == color) { pieces++; @@ -473,7 +475,7 @@ void Cube::PushCenterPieces(byte src, byte dst, byte color) } //reset the start point - start = Mid; + start = 1; //Rotate the src face to prepare for the next quadrant Move(src, 0, 1);