diff options
| author | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-01 09:33:26 +0200 |
|---|---|---|
| committer | Sebastiano Tronto <sebastiano@tronto.net> | 2025-04-01 09:33:26 +0200 |
| commit | b0053277e385bee23336d1fe6b69a12f49f9172f (patch) | |
| tree | 531e44cd6f8e807c991d0a46692140667939fbe3 | |
| parent | b6c1ff6cfdfe0f4ce602fe83e54c3112a1c95690 (diff) | |
| download | nissy-core-b0053277e385bee23336d1fe6b69a12f49f9172f.tar.gz nissy-core-b0053277e385bee23336d1fe6b69a12f49f9172f.zip | |
simplified allowedmoves logic
| -rw-r--r-- | src/core/moves.h | 52 | ||||
| -rw-r--r-- | src/solvers/coord/solve.h | 14 | ||||
| -rw-r--r-- | src/solvers/h48/gendata_h48.h | 4 | ||||
| -rw-r--r-- | src/solvers/h48/solve.h | 21 | ||||
| -rw-r--r-- | src/solvers/solutions.h | 2 | ||||
| -rw-r--r-- | src/utils/constants.h | 21 | ||||
| -rw-r--r-- | test/080_allowedmoves/00_empty.in (renamed from test/080_allowednext/00_empty_U.in) | 1 | ||||
| -rw-r--r-- | test/080_allowedmoves/00_empty.out (renamed from test/080_allowednext/00_empty_U.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/01_onemove.in | 2 | ||||
| -rw-r--r-- | test/080_allowedmoves/01_onemove.out (renamed from test/080_allowednext/02_U_F.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/02_F_F2.in (renamed from test/080_allowednext/01_F_F2.in) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/02_F_F2.out (renamed from test/080_allowednext/01_F_F2.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/03_U_F.in (renamed from test/080_allowednext/02_U_F.in) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/03_U_F.out (renamed from test/080_allowednext/04_longer_true.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/04_R_L_R.in (renamed from test/080_allowednext/03_R_L_R.in) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/04_R_L_R.out (renamed from test/080_allowednext/03_R_L_R.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/05_longer_true.in (renamed from test/080_allowednext/04_longer_true.in) | 8 | ||||
| -rw-r--r-- | test/080_allowedmoves/05_longer_true.out | 1 | ||||
| -rw-r--r-- | test/080_allowedmoves/06_longer_false.in (renamed from test/080_allowednext/05_longer_false.in) | 11 | ||||
| -rw-r--r-- | test/080_allowedmoves/06_longer_false.out (renamed from test/080_allowednext/05_longer_false.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/07_D_U_false_order.in (renamed from test/080_allowednext/06_D_U_false_order.in) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/07_D_U_false_order.out (renamed from test/080_allowednext/06_D_U_false_order.out) | 0 | ||||
| -rw-r--r-- | test/080_allowedmoves/allowedmoves_tests.c (renamed from test/080_allowednext/allowednext_tests.c) | 8 |
23 files changed, 74 insertions, 71 deletions
diff --git a/src/core/moves.h b/src/core/moves.h index 11ac34e..1238c7d 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -1,15 +1,13 @@ | |||
| 1 | #define MOVE(M, c) compose(c, MOVE_CUBE_ ## M) | 1 | #define MOVE(M, c) compose(c, MOVE_CUBE_ ## M) |
| 2 | #define PREMOVE(M, c) compose(MOVE_CUBE_ ## M, c) | 2 | #define PREMOVE(M, c) compose(MOVE_CUBE_ ## M, c) |
| 3 | 3 | ||
| 4 | STATIC_INLINE bool allowednextmove(size_t n, const uint8_t [n]); | 4 | STATIC_INLINE bool allowednextmove(uint8_t, uint8_t); |
| 5 | STATIC_INLINE uint32_t allowednextmove_mask(size_t n, const uint8_t [n]); | ||
| 6 | STATIC bool allowedmoves(size_t n, const uint8_t [n]); | 5 | STATIC bool allowedmoves(size_t n, const uint8_t [n]); |
| 7 | 6 | ||
| 8 | STATIC_INLINE uint8_t movebase(uint8_t); | 7 | STATIC_INLINE uint8_t movebase(uint8_t); |
| 9 | STATIC_INLINE uint8_t moveaxis(uint8_t); | 8 | STATIC_INLINE uint8_t moveaxis(uint8_t); |
| 10 | STATIC_INLINE bool isbase(uint8_t); | 9 | STATIC_INLINE bool isbase(uint8_t); |
| 11 | STATIC_INLINE bool parallel(uint8_t, uint8_t); | 10 | STATIC_INLINE bool parallel(uint8_t, uint8_t); |
| 12 | STATIC_INLINE uint32_t disable_moves(uint32_t, uint8_t); | ||
| 13 | 11 | ||
| 14 | STATIC cube_t move(cube_t, uint8_t); | 12 | STATIC cube_t move(cube_t, uint8_t); |
| 15 | STATIC cube_t premove(cube_t, uint8_t); | 13 | STATIC cube_t premove(cube_t, uint8_t); |
| @@ -38,60 +36,24 @@ STATIC cube_t applymoves(cube_t, const char *); | |||
| 38 | ARG_ACTION \ | 36 | ARG_ACTION \ |
| 39 | } | 37 | } |
| 40 | 38 | ||
| 41 | STATIC bool | 39 | STATIC_INLINE bool |
| 42 | allowednextmove(size_t n, const uint8_t moves[n]) | 40 | allowednextmove(uint8_t m1, uint8_t m2) |
| 43 | { | 41 | { |
| 44 | return n == 0 || allowednextmove_mask(n-1, moves) & (1 << moves[n-1]); | 42 | return allowedmask[movebase(m1)] & (UINT32_C(1) << m2); |
| 45 | } | ||
| 46 | |||
| 47 | STATIC uint32_t | ||
| 48 | allowednextmove_mask(size_t n, const uint8_t moves[n]) | ||
| 49 | { | ||
| 50 | uint32_t result; | ||
| 51 | uint8_t base1, base2, axis1, axis2; | ||
| 52 | |||
| 53 | result = MM_ALLMOVES; | ||
| 54 | |||
| 55 | if (n == 0) | ||
| 56 | return result; | ||
| 57 | |||
| 58 | base1 = movebase(moves[n-1]); | ||
| 59 | axis1 = moveaxis(moves[n-1]); | ||
| 60 | result = disable_moves(result, base1 * 3); | ||
| 61 | |||
| 62 | if (base1 % 2) | ||
| 63 | result = disable_moves(result, (base1 - 1) * 3); | ||
| 64 | |||
| 65 | if (n == 1) | ||
| 66 | return result; | ||
| 67 | |||
| 68 | base2 = movebase(moves[n-2]); | ||
| 69 | axis2 = moveaxis(moves[n-2]); | ||
| 70 | |||
| 71 | if(axis1 == axis2) | ||
| 72 | result = disable_moves(result, base2 * 3); | ||
| 73 | |||
| 74 | return result; | ||
| 75 | } | 43 | } |
| 76 | 44 | ||
| 77 | STATIC bool | 45 | STATIC bool |
| 78 | allowedmoves(size_t n, const uint8_t moves[n]) | 46 | allowedmoves(size_t n, const uint8_t m[n]) |
| 79 | { | 47 | { |
| 80 | uint8_t j; | 48 | uint8_t j; |
| 81 | 49 | ||
| 82 | for (j = 2; j < n; j++) | 50 | for (j = 1; j < n; j++) |
| 83 | if (!allowednextmove(j, moves)) | 51 | if (!allowednextmove(m[j-1], m[j])) |
| 84 | return false; | 52 | return false; |
| 85 | 53 | ||
| 86 | return true; | 54 | return true; |
| 87 | } | 55 | } |
| 88 | 56 | ||
| 89 | STATIC_INLINE uint32_t | ||
| 90 | disable_moves(uint32_t current_result, uint8_t base_index) | ||
| 91 | { | ||
| 92 | return current_result & ~MM_SIDE(base_index); | ||
| 93 | } | ||
| 94 | |||
| 95 | STATIC_INLINE uint8_t | 57 | STATIC_INLINE uint8_t |
| 96 | movebase(uint8_t move) | 58 | movebase(uint8_t move) |
| 97 | { | 59 | { |
diff --git a/src/solvers/coord/solve.h b/src/solvers/coord/solve.h index c3fbd02..fa4134a 100644 --- a/src/solvers/coord/solve.h +++ b/src/solvers/coord/solve.h | |||
| @@ -135,7 +135,12 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 135 | ret = 0; | 135 | ret = 0; |
| 136 | if (coord_continue_onnormal(arg)) { | 136 | if (coord_continue_onnormal(arg)) { |
| 137 | l = arg->solution_moves->nmoves; | 137 | l = arg->solution_moves->nmoves; |
| 138 | mm = allowednextmove_mask(l, arg->solution_moves->moves); | 138 | if (l == 0) { |
| 139 | mm = MM_ALLMOVES; | ||
| 140 | } else { | ||
| 141 | m = arg->solution_moves->moves[l-1]; | ||
| 142 | mm = allowedmask[movebase(m)]; | ||
| 143 | } | ||
| 139 | arg->solution_moves->nmoves++; | 144 | arg->solution_moves->nmoves++; |
| 140 | arg->lastisnormal = true; | 145 | arg->lastisnormal = true; |
| 141 | 146 | ||
| @@ -160,7 +165,12 @@ solve_coord_dfs(dfsarg_solve_coord_t arg[static 1]) | |||
| 160 | 165 | ||
| 161 | if (coord_continue_oninverse(arg)) { | 166 | if (coord_continue_oninverse(arg)) { |
| 162 | l = arg->solution_moves->npremoves; | 167 | l = arg->solution_moves->npremoves; |
| 163 | mm = allowednextmove_mask(l, arg->solution_moves->premoves); | 168 | if (l == 0) { |
| 169 | mm = MM_ALLMOVES; | ||
| 170 | } else { | ||
| 171 | m = arg->solution_moves->premoves[l-1]; | ||
| 172 | mm = allowedmask[movebase(m)]; | ||
| 173 | } | ||
| 164 | arg->solution_moves->npremoves++; | 174 | arg->solution_moves->npremoves++; |
| 165 | arg->lastisnormal = false; | 175 | arg->lastisnormal = false; |
| 166 | 176 | ||
diff --git a/src/solvers/h48/gendata_h48.h b/src/solvers/h48/gendata_h48.h index 959264d..b6647ed 100644 --- a/src/solvers/h48/gendata_h48.h +++ b/src/solvers/h48/gendata_h48.h | |||
| @@ -526,7 +526,7 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t arg[static 1]) | |||
| 526 | /* Depth d+3 */ | 526 | /* Depth d+3 */ |
| 527 | for (m[2] = 0; m[2] < 18; m[2]++) { | 527 | for (m[2] = 0; m[2] < 18; m[2]++) { |
| 528 | markarg.depth = d+3; | 528 | markarg.depth = d+3; |
| 529 | if (!allowednextmove(3, m)) { | 529 | if (!allowednextmove(m[1], m[2])) { |
| 530 | m[2] += 2; | 530 | m[2] += 2; |
| 531 | continue; | 531 | continue; |
| 532 | } | 532 | } |
| @@ -541,7 +541,7 @@ gendata_h48k2_dfs(h48k2_dfs_arg_t arg[static 1]) | |||
| 541 | /* Depth d+4 */ | 541 | /* Depth d+4 */ |
| 542 | for (m[3] = 0; m[3] < 18; m[3]++) { | 542 | for (m[3] = 0; m[3] < 18; m[3]++) { |
| 543 | markarg.depth = d+4; | 543 | markarg.depth = d+4; |
| 544 | if (!allowednextmove(4, m)) { | 544 | if (!allowednextmove(m[2], m[3])) { |
| 545 | m[3] += 2; | 545 | m[3] += 2; |
| 546 | continue; | 546 | continue; |
| 547 | } | 547 | } |
diff --git a/src/solvers/h48/solve.h b/src/solvers/h48/solve.h index dcec5a4..fc7631f 100644 --- a/src/solvers/h48/solve.h +++ b/src/solvers/h48/solve.h | |||
| @@ -176,10 +176,16 @@ solve_h48_dfs(dfsarg_solve_h48_t arg[static 1]) | |||
| 176 | ulbi = arg->use_lb_inverse; | 176 | ulbi = arg->use_lb_inverse; |
| 177 | 177 | ||
| 178 | ret = 0; | 178 | ret = 0; |
| 179 | mm_normal = allowednextmove_mask(arg->solution_moves->nmoves, | 179 | mm_normal = arg->movemask_normal; |
| 180 | arg->solution_moves->moves) & arg->movemask_normal; | 180 | if (arg->solution_moves->nmoves > 0) { |
| 181 | mm_inverse = allowednextmove_mask(arg->solution_moves->npremoves, | 181 | m = arg->solution_moves->moves[arg->solution_moves->nmoves-1]; |
| 182 | arg->solution_moves->premoves) & arg->movemask_inverse; | 182 | mm_normal &= allowedmask[movebase(m)]; |
| 183 | } | ||
| 184 | mm_inverse = arg->movemask_inverse; | ||
| 185 | if (arg->solution_moves->npremoves > 0) { | ||
| 186 | m = arg->solution_moves->premoves[arg->solution_moves->npremoves-1]; | ||
| 187 | mm_inverse &= allowedmask[movebase(m)]; | ||
| 188 | } | ||
| 183 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { | 189 | if (popcount_u32(mm_normal) <= popcount_u32(mm_inverse)) { |
| 184 | arg->solution_moves->nmoves++; | 190 | arg->solution_moves->nmoves++; |
| 185 | for (m = 0; m < 18; m++) { | 191 | for (m = 0; m < 18; m++) { |
| @@ -299,7 +305,12 @@ solve_h48_maketasks( | |||
| 299 | return NISSY_OK; | 305 | return NISSY_OK; |
| 300 | } | 306 | } |
| 301 | 307 | ||
| 302 | mm = allowednextmove_mask(maketasks_arg->nmoves, maketasks_arg->moves); | 308 | if (maketasks_arg->nmoves == 0) { |
| 309 | mm = MM_ALLMOVES; | ||
| 310 | } else { | ||
| 311 | m = maketasks_arg->moves[maketasks_arg->nmoves-1]; | ||
| 312 | mm = allowedmask[movebase(m)]; | ||
| 313 | } | ||
| 303 | 314 | ||
| 304 | maketasks_arg->nmoves++; | 315 | maketasks_arg->nmoves++; |
| 305 | backup_cube = maketasks_arg->cube; | 316 | backup_cube = maketasks_arg->cube; |
diff --git a/src/solvers/solutions.h b/src/solvers/solutions.h index bbff9cf..1b5517c 100644 --- a/src/solvers/solutions.h +++ b/src/solvers/solutions.h | |||
| @@ -128,7 +128,7 @@ appendsolution( | |||
| 128 | 128 | ||
| 129 | /* | 129 | /* |
| 130 | This is a bit ugly: we have to sort now and then again | 130 | This is a bit ugly: we have to sort now and then again |
| 131 | later, because the allowednext check would fail with | 131 | later, because the allowedmoves check would fail with |
| 132 | improperly sorted parallel moves, but then transforming | 132 | improperly sorted parallel moves, but then transforming |
| 133 | could swap the pairs the wrong way around. | 133 | could swap the pairs the wrong way around. |
| 134 | TODO: maybe fix this | 134 | TODO: maybe fix this |
diff --git a/src/utils/constants.h b/src/utils/constants.h index a6c6b7a..ba7f4d4 100644 --- a/src/utils/constants.h +++ b/src/utils/constants.h | |||
| @@ -102,7 +102,17 @@ STATIC int64_t binomial[12][12] = { | |||
| 102 | 102 | ||
| 103 | #define MM_ALLMOVES UINT32_C(0x3FFFF) | 103 | #define MM_ALLMOVES UINT32_C(0x3FFFF) |
| 104 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) | 104 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) |
| 105 | #define MM_SIDE(m) (UINT32_C(7) << (uint32_t)(m)) | 105 | #define MM_SINGLE(m) (UINT32_C(1) << (uint32_t)(m)) |
| 106 | #define MM_FACE(m) (UINT32_C(7) << (uint32_t)(m)) | ||
| 107 | #define MM_EO (\ | ||
| 108 | MM_FACE(MOVE_U) | MM_FACE(MOVE_D) |\ | ||
| 109 | MM_FACE(MOVE_R) | MM_FACE(MOVE_L) |\ | ||
| 110 | MM_SINGLE(MOVE_F2) | MM_SINGLE(MOVE_B2)) | ||
| 111 | #define MM_DR (\ | ||
| 112 | MM_FACE(MOVE_U) | MM_FACE(MOVE_D) |\ | ||
| 113 | MM_SINGLE(MOVE_R2) | MM_SINGLE(MOVE_L2) |\ | ||
| 114 | MM_SINGLE(MOVE_F2) | MM_SINGLE(MOVE_B2)) | ||
| 115 | #define MM_HTR (MM_ALLMOVES & ~MM_NOHALFTURNS) | ||
| 106 | 116 | ||
| 107 | #define TM_ALLTRANS UINT64_C(0xFFFFFFFFFFFF) | 117 | #define TM_ALLTRANS UINT64_C(0xFFFFFFFFFFFF) |
| 108 | #define TM_SINGLE(t) (UINT64_C(1) << (uint64_t)(t)) | 118 | #define TM_SINGLE(t) (UINT64_C(1) << (uint64_t)(t)) |
| @@ -151,6 +161,15 @@ STATIC int64_t binomial[12][12] = { | |||
| 151 | #define EFLIP UINT8_C(0x10) | 161 | #define EFLIP UINT8_C(0x10) |
| 152 | #define UINT8_ERROR UINT8_MAX | 162 | #define UINT8_ERROR UINT8_MAX |
| 153 | 163 | ||
| 164 | STATIC const uint32_t allowedmask[] = { | ||
| 165 | UINT32_C(0x3FFF8), | ||
| 166 | UINT32_C(0x3FFC0), | ||
| 167 | UINT32_C(0x3FE3F), | ||
| 168 | UINT32_C(0x3F03F), | ||
| 169 | UINT32_C(0x38FFF), | ||
| 170 | UINT32_C(0x00FFF) | ||
| 171 | }; | ||
| 172 | |||
| 154 | STATIC const char *cornerstr[] = { | 173 | STATIC const char *cornerstr[] = { |
| 155 | [CORNER_UFR] = "UFR", | 174 | [CORNER_UFR] = "UFR", |
| 156 | [CORNER_UBL] = "UBL", | 175 | [CORNER_UBL] = "UBL", |
diff --git a/test/080_allowednext/00_empty_U.in b/test/080_allowedmoves/00_empty.in index feb4bc3..573541a 100644 --- a/test/080_allowednext/00_empty_U.in +++ b/test/080_allowedmoves/00_empty.in | |||
| @@ -1,2 +1 @@ | |||
| 1 | 0 | 0 | |
| 2 | U | ||
diff --git a/test/080_allowednext/00_empty_U.out b/test/080_allowedmoves/00_empty.out index 27ba77d..27ba77d 100644 --- a/test/080_allowednext/00_empty_U.out +++ b/test/080_allowedmoves/00_empty.out | |||
diff --git a/test/080_allowedmoves/01_onemove.in b/test/080_allowedmoves/01_onemove.in new file mode 100644 index 0000000..aac8dac --- /dev/null +++ b/test/080_allowedmoves/01_onemove.in | |||
| @@ -0,0 +1,2 @@ | |||
| 1 | 1 | ||
| 2 | B' | ||
diff --git a/test/080_allowednext/02_U_F.out b/test/080_allowedmoves/01_onemove.out index 27ba77d..27ba77d 100644 --- a/test/080_allowednext/02_U_F.out +++ b/test/080_allowedmoves/01_onemove.out | |||
diff --git a/test/080_allowednext/01_F_F2.in b/test/080_allowedmoves/02_F_F2.in index 93f0a9c..93f0a9c 100644 --- a/test/080_allowednext/01_F_F2.in +++ b/test/080_allowedmoves/02_F_F2.in | |||
diff --git a/test/080_allowednext/01_F_F2.out b/test/080_allowedmoves/02_F_F2.out index c508d53..c508d53 100644 --- a/test/080_allowednext/01_F_F2.out +++ b/test/080_allowedmoves/02_F_F2.out | |||
diff --git a/test/080_allowednext/02_U_F.in b/test/080_allowedmoves/03_U_F.in index ad3607e..ad3607e 100644 --- a/test/080_allowednext/02_U_F.in +++ b/test/080_allowedmoves/03_U_F.in | |||
diff --git a/test/080_allowednext/04_longer_true.out b/test/080_allowedmoves/03_U_F.out index 27ba77d..27ba77d 100644 --- a/test/080_allowednext/04_longer_true.out +++ b/test/080_allowedmoves/03_U_F.out | |||
diff --git a/test/080_allowednext/03_R_L_R.in b/test/080_allowedmoves/04_R_L_R.in index ffd9542..ffd9542 100644 --- a/test/080_allowednext/03_R_L_R.in +++ b/test/080_allowedmoves/04_R_L_R.in | |||
diff --git a/test/080_allowednext/03_R_L_R.out b/test/080_allowedmoves/04_R_L_R.out index c508d53..c508d53 100644 --- a/test/080_allowednext/03_R_L_R.out +++ b/test/080_allowedmoves/04_R_L_R.out | |||
diff --git a/test/080_allowednext/04_longer_true.in b/test/080_allowedmoves/05_longer_true.in index 0360619..1d9999c 100644 --- a/test/080_allowednext/04_longer_true.in +++ b/test/080_allowedmoves/05_longer_true.in | |||
| @@ -1,11 +1,11 @@ | |||
| 1 | 11 | 1 | 11 |
| 2 | F2 | 2 | F2 |
| 3 | B | 3 | B |
| 4 | D2 | ||
| 5 | D' | ||
| 6 | L | ||
| 7 | R2 | ||
| 8 | U | 4 | U |
| 5 | D' | ||
| 6 | R | ||
| 7 | L2 | ||
| 8 | F | ||
| 9 | U' | 9 | U' |
| 10 | D | 10 | D |
| 11 | F | 11 | F |
diff --git a/test/080_allowedmoves/05_longer_true.out b/test/080_allowedmoves/05_longer_true.out new file mode 100644 index 0000000..27ba77d --- /dev/null +++ b/test/080_allowedmoves/05_longer_true.out | |||
| @@ -0,0 +1 @@ | |||
| true | |||
diff --git a/test/080_allowednext/05_longer_false.in b/test/080_allowedmoves/06_longer_false.in index 6cf8ecd..00fe94f 100644 --- a/test/080_allowednext/05_longer_false.in +++ b/test/080_allowedmoves/06_longer_false.in | |||
| @@ -1,9 +1,12 @@ | |||
| 1 | 8 | 1 | 8 |
| 2 | D | 2 | D |
| 3 | B2 | ||
| 4 | F' | 3 | F' |
| 4 | B2 | ||
| 5 | L' | 5 | L' |
| 6 | F' | 6 | F' |
| 7 | L' | 7 | R' |
| 8 | R2 | 8 | L2 |
| 9 | L | 9 | R |
| 10 | B | ||
| 11 | U2 | ||
| 12 | D | ||
diff --git a/test/080_allowednext/05_longer_false.out b/test/080_allowedmoves/06_longer_false.out index c508d53..c508d53 100644 --- a/test/080_allowednext/05_longer_false.out +++ b/test/080_allowedmoves/06_longer_false.out | |||
diff --git a/test/080_allowednext/06_D_U_false_order.in b/test/080_allowedmoves/07_D_U_false_order.in index 680d1a1..680d1a1 100644 --- a/test/080_allowednext/06_D_U_false_order.in +++ b/test/080_allowedmoves/07_D_U_false_order.in | |||
diff --git a/test/080_allowednext/06_D_U_false_order.out b/test/080_allowedmoves/07_D_U_false_order.out index c508d53..c508d53 100644 --- a/test/080_allowednext/06_D_U_false_order.out +++ b/test/080_allowedmoves/07_D_U_false_order.out | |||
diff --git a/test/080_allowednext/allowednext_tests.c b/test/080_allowedmoves/allowedmoves_tests.c index 08fe491..aa6bda7 100644 --- a/test/080_allowednext/allowednext_tests.c +++ b/test/080_allowedmoves/allowedmoves_tests.c | |||
| @@ -1,6 +1,6 @@ | |||
| 1 | #include "../test.h" | 1 | #include "../test.h" |
| 2 | 2 | ||
| 3 | bool allowednextmove(size_t n, const uint8_t [n]); | 3 | bool allowedmoves(size_t n, const uint8_t [n]); |
| 4 | 4 | ||
| 5 | static char *moves[] = { | 5 | static char *moves[] = { |
| 6 | "U", "U2", "U'", | 6 | "U", "U2", "U'", |
| @@ -27,9 +27,5 @@ void run(void) { | |||
| 27 | m[i] = j; | 27 | m[i] = j; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | fprintf(stderr, "Last two: %s, %s\nNext: %s\n", | 30 | printf("%s\n", allowedmoves(n, m) ? "true" : "false"); |
| 31 | n > 2 ? moves[m[n-3]] : "-", | ||
| 32 | n > 1 ? moves[m[n-2]] : "-", | ||
| 33 | n > 0 ? moves[m[n-1]] : "-"); | ||
| 34 | printf("%s\n", allowednextmove(n, m) ? "true" : "false"); | ||
| 35 | } | 31 | } |
