diff options
Diffstat (limited to '')
| -rw-r--r-- | old/2021-05-26-before-restyle/moves.h | 51 |
1 files changed, 51 insertions, 0 deletions
diff --git a/old/2021-05-26-before-restyle/moves.h b/old/2021-05-26-before-restyle/moves.h new file mode 100644 index 0000000..0608e1b --- /dev/null +++ b/old/2021-05-26-before-restyle/moves.h | |||
| @@ -0,0 +1,51 @@ | |||
| 1 | #ifndef MOVES_H | ||
| 2 | #define MOVES_H | ||
| 3 | |||
| 4 | #include <stdio.h> | ||
| 5 | #include <stdbool.h> | ||
| 6 | #include <stdint.h> | ||
| 7 | #include "cube.h" | ||
| 8 | #include "utils.h" | ||
| 9 | |||
| 10 | #define NMOVES (z3+1) | ||
| 11 | |||
| 12 | typedef enum { | ||
| 13 | NULLMOVE, | ||
| 14 | U, U2, U3, D, D2, D3, R, R2, R3, L, L2, L3, F, F2, F3, B, B2, B3, | ||
| 15 | Uw, Uw2, Uw3, Dw, Dw2, Dw3, Rw, Rw2, Rw3, | ||
| 16 | Lw, Lw2, Lw3, Fw, Fw2, Fw3, Bw, Bw2, Bw3, | ||
| 17 | M, M2, M3, S, S2, S3, E, E2, E3, | ||
| 18 | x, x2, x3, y, y2, y3, z, z2, z3, | ||
| 19 | } Move; | ||
| 20 | |||
| 21 | /* An alg is an array of "NissMoves", which can be on normal or on inverse. */ | ||
| 22 | typedef struct { bool inverse; Move m; } NissMove; | ||
| 23 | |||
| 24 | /* Movesets */ | ||
| 25 | extern bool standard_moveset[NMOVES]; | ||
| 26 | |||
| 27 | extern bool commute[NMOVES][NMOVES]; | ||
| 28 | extern bool possible_next[NMOVES][NMOVES][NMOVES]; | ||
| 29 | extern Move inverse[NMOVES]; | ||
| 30 | extern NissMove rotation_algs[24][3]; /* Same order as transformations */ | ||
| 31 | |||
| 32 | int len(NissMove *alg); | ||
| 33 | int copy_alg(NissMove *src, NissMove *dest); /*return number of moves copied */ | ||
| 34 | int invert_alg(NissMove *src, NissMove *dest); | ||
| 35 | int concat(NissMove *src1, NissMove *src2, NissMove *dest); | ||
| 36 | void print_alg(NissMove *alg); | ||
| 37 | int read_moves(char *str, NissMove *alg, int n); /* reads at most n moves */ | ||
| 38 | void cleanup(NissMove *src, int n); /* rewrites using basic moves, at most n */ | ||
| 39 | |||
| 40 | bool is_solved_up_to_reorient(Cube cube); | ||
| 41 | Cube move_cube(Move m, Cube cube); | ||
| 42 | Cube apply_alg(NissMove *alg, Cube cube); | ||
| 43 | Cube apply_alg_filtered(NissMove *alg, Cube cube, PieceFilter f); | ||
| 44 | |||
| 45 | /* Merge the following two? | ||
| 46 | always in this order */ | ||
| 47 | void init_ttables(bool read, bool write); | ||
| 48 | void init_aux_tables(); | ||
| 49 | |||
| 50 | |||
| 51 | #endif | ||
