cs0x7f / TPR-4x4x4-Solver

4x4x4 Solver = Three-Phase-Reduction Solver + 3x3x3 Solver
24 stars 5 forks source link

Cancelling moves between stages #5

Open jfly opened 11 years ago

jfly commented 11 years ago

I've seen some scrambles like:

U2 F' L2 F' D2 F' L2 B U2 B2 L' U2 F' D F2 L R2 D L' U2 Uw2 B Uw2 R' F Uw2 Rw2 L F2 U2 B Uw2 Uw' D Rw2 R' U2 L U' Fw' Uw L2 Uw2 Rw F'

There's a Uw2 Uw' in here. Here's a hacked version of FullCube.java that causes this problem:

public FullCube(Random r) {
        //<<<edge = new EdgeCube(r);
        //<<<center = new CenterCube(r);
        //<<<corner = new CornerCube(r);

        edge = new EdgeCube(r);//<<<
        //edge.ep = new byte[] {10, 18, 2,  21, 12, 15, 17, 22, 4,  14, 1,  11, 8,  6,  5,  19, 20, 3,  16, 7,  9,  13, 0,  23};
        edge.ep = new byte[] { 2,   15,  10,  23,  7,   1,   11,  13,  12,  6,   20,  16,  3,   5,   9,   19,  14,  18,  22,  8,   17,  0,   4,   21 };
        center = new CenterCube(r);//<<<
        center.ct = new byte[] { 5, 2,   1,   0,   1,   0 ,  4,   5  , 1,   3,   4,   3,   2,   2,   4,   0,   1,   5,   4,   5,   3,   3,   0,   2 };
        corner = new CornerCube(34651, 1086);//<<<
    }

From looking at Search.java's run(), it looks like no effort is made to cancel moves between stages. This is something that would be nice to have. Alternatively, we could resurrect TNoodle's TurnBuilder in CubeScrambler.java to hack around this @clementgallet

clementgallet commented 11 years ago

I can't run it right now, but I guess it is:

Stage 1: F Rw' Uw2 L2 Uw' Fw Stage 2: U L' U2 R Rw2 D' Uw Stage 3: Uw2 B' ...

I guess it happens because the program breaks when the first solution is found, even if it searches in a specific order so to get solutions among the shortest. @ChenShuang what about letting the loop on L274 (https://github.com/ChenShuang/TPR-4x4x4-Solver/blob/master/src/Search.java#L274) going until the end before breaking, and keeping the best solution ?

cs0x7f commented 11 years ago

I think the best solution to this bug now is to write/use the TurnBuilder because I haven't found a reasonable way to process move canceling between stages.