h48

A prototype for an optimal Rubik's cube solver, work in progress.
git clone https://git.tronto.net/h48
Download | Log | Files | Refs | README | LICENSE

commit 082cdd96c693d3035539959bd8d400d19b200f67
parent 68ec5f85e346863bffb64b186d7ef9046ba5b9a4
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sun,  6 Oct 2024 18:02:09 +0200

Tiny optimization for moves (avoid unnecessary CO)

This is like 1% improvement to solver, but it is easy enough so I'll keep it

Diffstat:
Msrc/core/moves.h | 22++++++++++++----------
Mtools/300_solve_small/solve_small.c | 2+-
2 files changed, 13 insertions(+), 11 deletions(-)

diff --git a/src/core/moves.h b/src/core/moves.h @@ -1,5 +1,7 @@ #define MOVE(M, c) compose(c, MOVE_CUBE_ ## M) +#define MOVE_NOCO(M, c) compose_epcpeo(c, MOVE_CUBE_ ## M) #define PREMOVE(M, c) compose(MOVE_CUBE_ ## M, c) +#define PREMOVE_NOCO(M, c) compose_epcpeo(MOVE_CUBE_ ## M, c) STATIC_INLINE bool allowednextmove(uint8_t *, uint8_t); @@ -88,39 +90,39 @@ move(cube_t c, uint8_t m) { switch (m) { case MOVE_U: - return MOVE(U, c); + return MOVE_NOCO(U, c); case MOVE_U2: - return MOVE(U2, c); + return MOVE_NOCO(U2, c); case MOVE_U3: - return MOVE(U3, c); + return MOVE_NOCO(U3, c); case MOVE_D: - return MOVE(D, c); + return MOVE_NOCO(D, c); case MOVE_D2: - return MOVE(D2, c); + return MOVE_NOCO(D2, c); case MOVE_D3: - return MOVE(D3, c); + return MOVE_NOCO(D3, c); case MOVE_R: return MOVE(R, c); case MOVE_R2: - return MOVE(R2, c); + return MOVE_NOCO(R2, c); case MOVE_R3: return MOVE(R3, c); case MOVE_L: return MOVE(L, c); case MOVE_L2: - return MOVE(L2, c); + return MOVE_NOCO(L2, c); case MOVE_L3: return MOVE(L3, c); case MOVE_F: return MOVE(F, c); case MOVE_F2: - return MOVE(F2, c); + return MOVE_NOCO(F2, c); case MOVE_F3: return MOVE(F3, c); case MOVE_B: return MOVE(B, c); case MOVE_B2: - return MOVE(B2, c); + return MOVE_NOCO(B2, c); case MOVE_B3: return MOVE(B3, c); default: diff --git a/tools/300_solve_small/solve_small.c b/tools/300_solve_small/solve_small.c @@ -8,7 +8,7 @@ char *buf; char *scrambles[] = { "R D' R2 D R U2 R' D' R U2 R D R'", /* 12 optimal */ "RLUD RLUD RLUD", /* 12 optimal */ - // "R' U' F D2 L2 F R2 U2 R2 B D2 L B2 D' B2 L' R' B D2 B U2 L U2 R' U' F", /* FMC2019 A1 - 16 optimal */ + "R' U' F D2 L2 F R2 U2 R2 B D2 L B2 D' B2 L' R' B D2 B U2 L U2 R' U' F", /* FMC2019 A1 - 16 optimal */ // "R' U' F D R F2 D L F D2 F2 L' U R' L2 D' R2 F2 R2 D L2 U2 R' U' F", /* FMC2024 A1 - 19 optimal */ NULL };