diff options
Diffstat (limited to 'src')
| -rw-r--r-- | src/core/moves.h | 16 | ||||
| -rw-r--r-- | src/utils/constants.h | 119 |
2 files changed, 115 insertions, 20 deletions
diff --git a/src/core/moves.h b/src/core/moves.h index 8f91167..bbc8e7c 100644 --- a/src/core/moves.h +++ b/src/core/moves.h | |||
| @@ -36,6 +36,10 @@ STATIC cube_t applymoves(cube_t, const char *); | |||
| 36 | LOG("Unknown move: %c\n", *VAR_B); \ | 36 | LOG("Unknown move: %c\n", *VAR_B); \ |
| 37 | return RET_ERROR; \ | 37 | return RET_ERROR; \ |
| 38 | } \ | 38 | } \ |
| 39 | if (*(VAR_B+1) == 'w') { \ | ||
| 40 | VAR_MOVE_NOMOD += 18; \ | ||
| 41 | VAR_B++; \ | ||
| 42 | } \ | ||
| 39 | if ((VAR_MOD = readmodifier(*(VAR_B+1))) != 0) \ | 43 | if ((VAR_MOD = readmodifier(*(VAR_B+1))) != 0) \ |
| 40 | VAR_B++; \ | 44 | VAR_B++; \ |
| 41 | ARG_MOVE = VAR_MOVE_NOMOD + VAR_MOD; \ | 45 | ARG_MOVE = VAR_MOVE_NOMOD + VAR_MOD; \ |
| @@ -58,6 +62,18 @@ readmove(char c) | |||
| 58 | return MOVE_F; | 62 | return MOVE_F; |
| 59 | case 'B': | 63 | case 'B': |
| 60 | return MOVE_B; | 64 | return MOVE_B; |
| 65 | case 'M': | ||
| 66 | return MOVE_M; | ||
| 67 | case 'S': | ||
| 68 | return MOVE_S; | ||
| 69 | case 'E': | ||
| 70 | return MOVE_E; | ||
| 71 | case 'x': | ||
| 72 | return MOVE_x; | ||
| 73 | case 'y': | ||
| 74 | return MOVE_y; | ||
| 75 | case 'z': | ||
| 76 | return MOVE_z; | ||
| 61 | default: | 77 | default: |
| 62 | return UINT8_ERROR; | 78 | return UINT8_ERROR; |
| 63 | } | 79 | } |
diff --git a/src/utils/constants.h b/src/utils/constants.h index 5ccff06..d6d48cc 100644 --- a/src/utils/constants.h +++ b/src/utils/constants.h | |||
| @@ -24,24 +24,63 @@ STATIC int64_t binomial[12][12] = { | |||
| 24 | {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, | 24 | {1, 11, 55, 165, 330, 462, 462, 330, 165, 55, 11, 1}, |
| 25 | }; | 25 | }; |
| 26 | 26 | ||
| 27 | #define MOVE_U UINT8_C(0) | 27 | #define MOVE_U UINT8_C(0) |
| 28 | #define MOVE_U2 UINT8_C(1) | 28 | #define MOVE_U2 UINT8_C(1) |
| 29 | #define MOVE_U3 UINT8_C(2) | 29 | #define MOVE_U3 UINT8_C(2) |
| 30 | #define MOVE_D UINT8_C(3) | 30 | #define MOVE_D UINT8_C(3) |
| 31 | #define MOVE_D2 UINT8_C(4) | 31 | #define MOVE_D2 UINT8_C(4) |
| 32 | #define MOVE_D3 UINT8_C(5) | 32 | #define MOVE_D3 UINT8_C(5) |
| 33 | #define MOVE_R UINT8_C(6) | 33 | #define MOVE_R UINT8_C(6) |
| 34 | #define MOVE_R2 UINT8_C(7) | 34 | #define MOVE_R2 UINT8_C(7) |
| 35 | #define MOVE_R3 UINT8_C(8) | 35 | #define MOVE_R3 UINT8_C(8) |
| 36 | #define MOVE_L UINT8_C(9) | 36 | #define MOVE_L UINT8_C(9) |
| 37 | #define MOVE_L2 UINT8_C(10) | 37 | #define MOVE_L2 UINT8_C(10) |
| 38 | #define MOVE_L3 UINT8_C(11) | 38 | #define MOVE_L3 UINT8_C(11) |
| 39 | #define MOVE_F UINT8_C(12) | 39 | #define MOVE_F UINT8_C(12) |
| 40 | #define MOVE_F2 UINT8_C(13) | 40 | #define MOVE_F2 UINT8_C(13) |
| 41 | #define MOVE_F3 UINT8_C(14) | 41 | #define MOVE_F3 UINT8_C(14) |
| 42 | #define MOVE_B UINT8_C(15) | 42 | #define MOVE_B UINT8_C(15) |
| 43 | #define MOVE_B2 UINT8_C(16) | 43 | #define MOVE_B2 UINT8_C(16) |
| 44 | #define MOVE_B3 UINT8_C(17) | 44 | #define MOVE_B3 UINT8_C(17) |
| 45 | |||
| 46 | #define MOVE_Uw UINT8_C(18) | ||
| 47 | #define MOVE_Uw2 UINT8_C(19) | ||
| 48 | #define MOVE_Uw3 UINT8_C(20) | ||
| 49 | #define MOVE_Dw UINT8_C(21) | ||
| 50 | #define MOVE_Dw2 UINT8_C(22) | ||
| 51 | #define MOVE_Dw3 UINT8_C(23) | ||
| 52 | #define MOVE_Rw UINT8_C(24) | ||
| 53 | #define MOVE_Rw2 UINT8_C(25) | ||
| 54 | #define MOVE_Rw3 UINT8_C(26) | ||
| 55 | #define MOVE_Lw UINT8_C(27) | ||
| 56 | #define MOVE_Lw2 UINT8_C(28) | ||
| 57 | #define MOVE_Lw3 UINT8_C(29) | ||
| 58 | #define MOVE_Fw UINT8_C(30) | ||
| 59 | #define MOVE_Fw2 UINT8_C(31) | ||
| 60 | #define MOVE_Fw3 UINT8_C(32) | ||
| 61 | #define MOVE_Bw UINT8_C(33) | ||
| 62 | #define MOVE_Bw2 UINT8_C(34) | ||
| 63 | #define MOVE_Bw3 UINT8_C(35) | ||
| 64 | |||
| 65 | #define MOVE_M UINT8_C(36) | ||
| 66 | #define MOVE_M2 UINT8_C(37) | ||
| 67 | #define MOVE_M3 UINT8_C(38) | ||
| 68 | #define MOVE_S UINT8_C(39) | ||
| 69 | #define MOVE_S2 UINT8_C(40) | ||
| 70 | #define MOVE_S3 UINT8_C(41) | ||
| 71 | #define MOVE_E UINT8_C(42) | ||
| 72 | #define MOVE_E2 UINT8_C(43) | ||
| 73 | #define MOVE_E3 UINT8_C(44) | ||
| 74 | |||
| 75 | #define MOVE_x UINT8_C(45) | ||
| 76 | #define MOVE_x2 UINT8_C(46) | ||
| 77 | #define MOVE_x3 UINT8_C(47) | ||
| 78 | #define MOVE_y UINT8_C(48) | ||
| 79 | #define MOVE_y2 UINT8_C(49) | ||
| 80 | #define MOVE_y3 UINT8_C(50) | ||
| 81 | #define MOVE_z UINT8_C(51) | ||
| 82 | #define MOVE_z2 UINT8_C(52) | ||
| 83 | #define MOVE_z3 UINT8_C(53) | ||
| 45 | 84 | ||
| 46 | #define TRANS_UFr UINT8_C(0) | 85 | #define TRANS_UFr UINT8_C(0) |
| 47 | #define TRANS_ULr UINT8_C(1) | 86 | #define TRANS_ULr UINT8_C(1) |
| @@ -97,8 +136,9 @@ STATIC int64_t binomial[12][12] = { | |||
| 97 | #define AXIS_RL UINT8_C(1) | 136 | #define AXIS_RL UINT8_C(1) |
| 98 | #define AXIS_FB UINT8_C(2) | 137 | #define AXIS_FB UINT8_C(2) |
| 99 | 138 | ||
| 100 | #define NMOVES (1+MOVE_B3) | 139 | #define NMOVES (1+MOVE_B3) |
| 101 | #define NTRANS (1+TRANS_BLm) | 140 | #define NMOVES_EXTENDED (1+MOVE_z3) |
| 141 | #define NTRANS (1+TRANS_BLm) | ||
| 102 | 142 | ||
| 103 | #define MM_ALLMOVES UINT32_C(0x3FFFF) | 143 | #define MM_ALLMOVES UINT32_C(0x3FFFF) |
| 104 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) | 144 | #define MM_NOHALFTURNS UINT32_C(0x2DB6D) |
| @@ -230,6 +270,45 @@ STATIC const char *movestr[] = { | |||
| 230 | [MOVE_B] = "B", | 270 | [MOVE_B] = "B", |
| 231 | [MOVE_B2] = "B2", | 271 | [MOVE_B2] = "B2", |
| 232 | [MOVE_B3] = "B'", | 272 | [MOVE_B3] = "B'", |
| 273 | |||
| 274 | [MOVE_Uw] = "Uw", | ||
| 275 | [MOVE_Uw2] = "Uw2", | ||
| 276 | [MOVE_Uw3] = "Uw'", | ||
| 277 | [MOVE_Dw] = "Dw", | ||
| 278 | [MOVE_Dw2] = "Dw2", | ||
| 279 | [MOVE_Dw3] = "Dw'", | ||
| 280 | [MOVE_Rw] = "Rw", | ||
| 281 | [MOVE_Rw2] = "Rw2", | ||
| 282 | [MOVE_Rw3] = "Rw'", | ||
| 283 | [MOVE_Lw] = "Lw", | ||
| 284 | [MOVE_Lw2] = "Lw2", | ||
| 285 | [MOVE_Lw3] = "Lw'", | ||
| 286 | [MOVE_Fw] = "Fw", | ||
| 287 | [MOVE_Fw2] = "Fw2", | ||
| 288 | [MOVE_Fw3] = "Fw'", | ||
| 289 | [MOVE_Bw] = "Bw", | ||
| 290 | [MOVE_Bw2] = "Bw2", | ||
| 291 | [MOVE_Bw3] = "Bw'", | ||
| 292 | |||
| 293 | [MOVE_M] = "M", | ||
| 294 | [MOVE_M2] = "M2", | ||
| 295 | [MOVE_M3] = "M'", | ||
| 296 | [MOVE_S] = "S", | ||
| 297 | [MOVE_S2] = "S2", | ||
| 298 | [MOVE_S3] = "S'", | ||
| 299 | [MOVE_E] = "E", | ||
| 300 | [MOVE_E2] = "E2", | ||
| 301 | [MOVE_E3] = "E'", | ||
| 302 | |||
| 303 | [MOVE_x] = "x", | ||
| 304 | [MOVE_x2] = "x2", | ||
| 305 | [MOVE_x3] = "x'", | ||
| 306 | [MOVE_y] = "y", | ||
| 307 | [MOVE_y2] = "y2", | ||
| 308 | [MOVE_y3] = "y'", | ||
| 309 | [MOVE_z] = "z", | ||
| 310 | [MOVE_z2] = "z2", | ||
| 311 | [MOVE_z3] = "z'", | ||
| 233 | }; | 312 | }; |
| 234 | 313 | ||
| 235 | STATIC const char *transstr[] = { | 314 | STATIC const char *transstr[] = { |
