diff options
Diffstat (limited to '')
| -rw-r--r-- | src/cubetypes.h | 16 | ||||
| -rw-r--r-- | src/fst.c | 58 | ||||
| -rw-r--r-- | src/fst.h | 12 |
3 files changed, 86 insertions, 0 deletions
diff --git a/src/cubetypes.h b/src/cubetypes.h index f9b4011..bb1ad10 100644 --- a/src/cubetypes.h +++ b/src/cubetypes.h | |||
| @@ -90,6 +90,7 @@ typedef struct commandargs CommandArgs; | |||
| 90 | typedef struct coordinate Coordinate; | 90 | typedef struct coordinate Coordinate; |
| 91 | typedef struct cube Cube; | 91 | typedef struct cube Cube; |
| 92 | typedef struct dfsarg DfsArg; | 92 | typedef struct dfsarg DfsArg; |
| 93 | typedef struct fstcube FstCube; | ||
| 93 | typedef struct indexer Indexer; | 94 | typedef struct indexer Indexer; |
| 94 | typedef struct movable Movable; | 95 | typedef struct movable Movable; |
| 95 | typedef struct moveset Moveset; | 96 | typedef struct moveset Moveset; |
| @@ -226,6 +227,21 @@ dfsarg | |||
| 226 | }; | 227 | }; |
| 227 | 228 | ||
| 228 | struct | 229 | struct |
| 230 | fstcube | ||
| 231 | { | ||
| 232 | uint16_t uf_eofb; | ||
| 233 | uint16_t uf_eposepe; | ||
| 234 | uint16_t uf_coud; | ||
| 235 | uint16_t uf_cp; | ||
| 236 | uint16_t fr_eofb; | ||
| 237 | uint16_t fr_eposepe; | ||
| 238 | uint16_t fr_coud; | ||
| 239 | uint16_t rd_eofb; | ||
| 240 | uint16_t rd_eposepe; | ||
| 241 | uint16_t rd_coud; | ||
| 242 | } | ||
| 243 | |||
| 244 | struct | ||
| 229 | indexer | 245 | indexer |
| 230 | { | 246 | { |
| 231 | int n; | 247 | int n; |
diff --git a/src/fst.c b/src/fst.c new file mode 100644 index 0000000..91c022a --- /dev/null +++ b/src/fst.c | |||
| @@ -0,0 +1,58 @@ | |||
| 1 | #define FST_C | ||
| 2 | |||
| 3 | #include "fst.h" | ||
| 4 | |||
| 5 | static void fst_to_ep(FstCube fst, int *ep); | ||
| 6 | |||
| 7 | FstCube | ||
| 8 | cube_to_fst(Cube *cube) | ||
| 9 | { | ||
| 10 | Cube c; | ||
| 11 | FstCube ret; | ||
| 12 | |||
| 13 | copy_cube(cube, &c); | ||
| 14 | ret.uf_eofb = index_eofb(&c); | ||
| 15 | ret.uf_eposepe = index_eposepe(&c); | ||
| 16 | ret.uf_coud = index_coud(&c); | ||
| 17 | ret.uf_cp = index_cp(&c); | ||
| 18 | copy_cube(cube, &c); | ||
| 19 | transform_cube(fr, &c); | ||
| 20 | ret.fr_eofb = index_eofb(&c); | ||
| 21 | ret.fr_eposepe = index_eposepe(&c); | ||
| 22 | ret.fr_coud = index_coud(&c); | ||
| 23 | transform_cube(rd, &c); | ||
| 24 | ret.rd_eofb = index_eofb(&c); | ||
| 25 | ret.rd_eposepe = index_eposepe(&c); | ||
| 26 | ret.rd_coud = index_coud(&c); | ||
| 27 | |||
| 28 | return ret; | ||
| 29 | } | ||
| 30 | |||
| 31 | FstCube | ||
| 32 | fst_inverse(FstCube fst) | ||
| 33 | { | ||
| 34 | /* TODO */ | ||
| 35 | } | ||
| 36 | |||
| 37 | FstCube | ||
| 38 | fst_move(Move m, FstCube fst) | ||
| 39 | { | ||
| 40 | /* TODO */ | ||
| 41 | } | ||
| 42 | |||
| 43 | void | ||
| 44 | fst_to_cube(FstCube fst, Cube *cube) | ||
| 45 | { | ||
| 46 | invindex_eofb((uint64_t)fst.uf_eofb, cube); | ||
| 47 | fst_to_ep(fst, cube->ep); | ||
| 48 | invindex_coud((uint64_t)fst.uf_coud, cube); | ||
| 49 | invindex_cp((uint64_t)fst.uf_cp, cube); | ||
| 50 | } | ||
| 51 | |||
| 52 | static void | ||
| 53 | fst_to_ep(FstCube fst, int *ep) | ||
| 54 | { | ||
| 55 | /* TODO */ | ||
| 56 | } | ||
| 57 | |||
| 58 | #endif | ||
diff --git a/src/fst.h b/src/fst.h new file mode 100644 index 0000000..94f6c30 --- /dev/null +++ b/src/fst.h | |||
| @@ -0,0 +1,12 @@ | |||
| 1 | #ifndef FST_H | ||
| 2 | #define FST_H | ||
| 3 | |||
| 4 | #include "coord.h" | ||
| 5 | |||
| 6 | FstCube cube_to_fst(Cube *cube); | ||
| 7 | FstCube fst_inverse(FstCube fst); | ||
| 8 | FstCube fst_move(Move m, FstCube fst); | ||
| 9 | void fst_to_cube(FstCube fst, Cube *cube); | ||
| 10 | |||
| 11 | #endif | ||
| 12 | |||
