diff options
| author | enricotenuti <tenutz_27@outlook.it> | 2024-08-30 17:47:48 +0200 |
|---|---|---|
| committer | enricotenuti <tenutz_27@outlook.it> | 2024-08-30 17:47:48 +0200 |
| commit | 4abb800c4b4f3a509c07821ade8d34e3699bdf10 (patch) | |
| tree | 92656dec1fe1ae38365d93c5a910fd415f979e1e /src | |
| parent | 754e632241859b224497ee4e0239670d5d90759f (diff) | |
| download | nissy-core-4abb800c4b4f3a509c07821ade8d34e3699bdf10.tar.gz nissy-core-4abb800c4b4f3a509c07821ade8d34e3699bdf10.zip | |
format fix
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/moves.h | 7 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 31 |
2 files changed, 19 insertions, 19 deletions
diff --git a/src/core/moves.h b/src/core/moves.h index 9753993..8f9c8f5 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -12,6 +12,7 @@ _static uint32_t allowednextmoveH48(uint8_t *, uint8_t, uint32_t); | |||
| 12 | _static_inline uint8_t inverse_trans(uint8_t); | 12 | _static_inline uint8_t inverse_trans(uint8_t); |
| 13 | _static_inline uint8_t movebase(uint8_t); | 13 | _static_inline uint8_t movebase(uint8_t); |
| 14 | _static_inline uint8_t moveaxis(uint8_t); | 14 | _static_inline uint8_t moveaxis(uint8_t); |
| 15 | _static_inline uint32_t disable_moves(uint32_t, uint8_t); | ||
| 15 | 16 | ||
| 16 | _static cube_t move(cube_t, uint8_t); | 17 | _static cube_t move(cube_t, uint8_t); |
| 17 | _static cube_t premove(cube_t, uint8_t); | 18 | _static cube_t premove(cube_t, uint8_t); |
| @@ -43,10 +44,10 @@ allowednextmove(uint8_t *moves, uint8_t n) | |||
| 43 | return axis[1] != axis[2] || base[0] != base[2]; | 44 | return axis[1] != axis[2] || base[0] != base[2]; |
| 44 | } | 45 | } |
| 45 | 46 | ||
| 46 | static uint32_t | 47 | _static_inline uint32_t |
| 47 | disable_moves(uint32_t current_result, uint8_t base_index) | 48 | disable_moves(uint32_t current_result, uint8_t base_index) |
| 48 | { | 49 | { |
| 49 | return current_result & ~((1 << base_index) | (1 << (base_index + 1)) | (1 << (base_index + 2))); | 50 | return current_result & ~(7 << base_index); |
| 50 | } | 51 | } |
| 51 | 52 | ||
| 52 | _static uint32_t | 53 | _static uint32_t |
| @@ -144,7 +145,7 @@ move(cube_t c, uint8_t m) | |||
| 144 | _static cube_t | 145 | _static cube_t |
| 145 | premove(cube_t c, uint8_t m) | 146 | premove(cube_t c, uint8_t m) |
| 146 | { | 147 | { |
| 147 | switch (m) { | 148 | switch (m) { |
| 148 | case _move_U: | 149 | case _move_U: |
| 149 | return _premove(U3, c); | 150 | return _premove(U3, c); |
| 150 | case _move_U2: | 151 | case _move_U2: |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index ed06a85..bbe59e5 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -29,8 +29,7 @@ typedef struct { | |||
| 29 | _static void solve_h48_appendsolution(dfsarg_solveh48_t *); | 29 | _static void solve_h48_appendsolution(dfsarg_solveh48_t *); |
| 30 | _static_inline bool solve_h48_stop(dfsarg_solveh48_t *); | 30 | _static_inline bool solve_h48_stop(dfsarg_solveh48_t *); |
| 31 | _static int64_t solve_h48_dfs(dfsarg_solveh48_t *); | 31 | _static int64_t solve_h48_dfs(dfsarg_solveh48_t *); |
| 32 | _static int64_t solve_h48( | 32 | _static int64_t solve_h48(cube_t, int8_t, int8_t, int8_t, uint8_t, uint8_t, const void *, char *); |
| 33 | cube_t, int8_t, int8_t, int8_t, uint8_t, uint8_t, const void *, char *); | ||
| 34 | 33 | ||
| 35 | _static int64_t solve_h48stats_dfs(dfsarg_solveh48stats_t *); | 34 | _static int64_t solve_h48stats_dfs(dfsarg_solveh48stats_t *); |
| 36 | _static int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); | 35 | _static int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); |
| @@ -38,26 +37,26 @@ _static int64_t solve_h48stats(cube_t, int8_t, const void *, char [static 12]); | |||
| 38 | _static void | 37 | _static void |
| 39 | solve_h48_appendsolution(dfsarg_solveh48_t *arg) | 38 | solve_h48_appendsolution(dfsarg_solveh48_t *arg) |
| 40 | { | 39 | { |
| 41 | int strl; | 40 | int strl; |
| 42 | char *solution = *arg->nextsol; | 41 | char *solution = *arg->nextsol; |
| 43 | 42 | ||
| 44 | strl = writemoves(arg->moves, arg->nmoves, *arg->nextsol); | 43 | strl = writemoves(arg->moves, arg->nmoves, *arg->nextsol); |
| 45 | *arg->nextsol += strl; | 44 | *arg->nextsol += strl; |
| 46 | 45 | ||
| 47 | if (arg->npremoves) { | 46 | if (arg->npremoves) { |
| 48 | **arg->nextsol = ' '; | 47 | **arg->nextsol = ' '; |
| 49 | (*arg->nextsol)++; | 48 | (*arg->nextsol)++; |
| 50 | 49 | ||
| 51 | uint8_t* invertedpremoves = invertpremoves(arg->premoves, arg->npremoves); | 50 | uint8_t* invertedpremoves = invertpremoves(arg->premoves, arg->npremoves); |
| 52 | strl = writemoves(invertedpremoves, arg->npremoves, *arg->nextsol); | 51 | strl = writemoves(invertedpremoves, arg->npremoves, *arg->nextsol); |
| 53 | free(invertedpremoves); | 52 | free(invertedpremoves); |
| 54 | *arg->nextsol += strl; | 53 | *arg->nextsol += strl; |
| 55 | } | 54 | } |
| 56 | LOG("Solution found: %s\n", solution); | 55 | LOG("Solution found: %s\n", solution); |
| 57 | 56 | ||
| 58 | **arg->nextsol = '\n'; | 57 | **arg->nextsol = '\n'; |
| 59 | (*arg->nextsol)++; | 58 | (*arg->nextsol)++; |
| 60 | (*arg->nsols)++; | 59 | (*arg->nsols)++; |
| 61 | } | 60 | } |
| 62 | 61 | ||
| 63 | _static_inline bool | 62 | _static_inline bool |
