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 0a45da13ca06f7884872160a6756a04d1eb849c5
parent 47a65b676d1de889706517f05659f0bb659782c9
Author: enricotenuti <tenutz_27@outlook.it>
Date:   Thu, 29 Aug 2024 19:28:13 +0200

constants fix

Diffstat:
Msrc/core/moves.h | 8++++----
Msrc/solvers/h48/solve.h | 7+++----
2 files changed, 7 insertions(+), 8 deletions(-)

diff --git a/src/core/moves.h b/src/core/moves.h @@ -1,8 +1,8 @@ /* probably these can be placed in constants file */ -#define NONISS 0x00 -#define NISS 0x01 +#define NORMAL 0x00 +#define INVERSE 0x01 #define INVERSEBRANCH 0x03 -#define BRANCH 0x02 +#define NORMALBRANCH 0x02 #define ALLMOVES 0x3FFFF #define NOHALFTURNS 0x2DB6D @@ -53,7 +53,7 @@ _static uint32_t allowednextmoveH48(uint8_t *moves, uint8_t n, uint32_t h48branch) { uint32_t result = ALLMOVES; - if (h48branch & BRANCH) + if (h48branch & NORMALBRANCH) result &= NOHALFTURNS; if (n < 1) return result; diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h @@ -66,7 +66,7 @@ solve_h48_stop(dfsarg_solveh48_t *arg) uint32_t data, data_inv; int8_t bound; - arg->nissbranch = NONISS; + arg->nissbranch = NORMAL; bound = get_h48_cdata(arg->cube, arg->cocsepdata, &data); if (bound + arg->nmoves + arg->npremoves > arg->depth) return true; @@ -86,7 +86,7 @@ solve_h48_stop(dfsarg_solveh48_t *arg) if (bound + arg->nmoves + arg->npremoves > arg->depth) return true; if (bound + arg->nmoves + arg->npremoves == arg->depth) - arg->nissbranch = BRANCH; + arg->nissbranch = NORMALBRANCH; return false; } @@ -115,7 +115,7 @@ solve_h48_dfs(dfsarg_solveh48_t *arg) nextarg = *arg; ret = 0; uint32_t allowed; - if(arg->nissbranch & 0x01) { + if(arg->nissbranch & INVERSE) { allowed = allowednextmoveH48(arg->premoves, arg->npremoves, arg->nissbranch); for (m = 0; m < 18; m++) { if(allowed & (1 << m)) { @@ -139,7 +139,6 @@ solve_h48_dfs(dfsarg_solveh48_t *arg) } } - return ret; }