From 2dce2a8a0ebd95e9e65d9d53206c4b2babc2af2f Mon Sep 17 00:00:00 2001 From: Sebastiano Tronto Date: Sat, 10 Sep 2022 19:13:02 +0200 Subject: Added fst_cube prototypes --- TODO.md | 13 ++++++------- src/cubetypes.h | 16 ++++++++++++++++ src/fst.c | 58 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ src/fst.h | 12 ++++++++++++ 4 files changed, 92 insertions(+), 7 deletions(-) create mode 100644 src/fst.c create mode 100644 src/fst.h diff --git a/TODO.md b/TODO.md index 30803fb..4421b49 100644 --- a/TODO.md +++ b/TODO.md @@ -4,6 +4,12 @@ This is a list of things that I would like to add or change at some point. It's more of a personal reminder than anything else. ## After symcoord +### fst_cube +* slightly different from cube in v2.0.2: each "side" coordinate + is a transformation of the other, not an eorl or similar (changes + the permutation!) +* inverse: for edges, just generate ep[12] and convert back +* corners: big table (150Mb if 16bit integers are used) ### Solving standard coordinates * add Void * extradata to DfsArg and a custom move function * add optional custom pre-process for generating special table (nx) @@ -12,13 +18,6 @@ It's more of a personal reminder than anything else. * implement nxopt with all tables and all tricks (maybe compile time variable for maximum memory to use?) * is_valid should also unniss / cleanup the alg -### fst_cube -* slightly different from cube in v2.0.2: each "side" coordinate - is a transformation of the other, not an eorl or similar (changes - the permutation!) -* add fst_index for some coordinates? -* inverse: for edges, just generate ep[12] and convert back -* corners: big table (150Mb if 16bit integers are used) ## For version 2.1 ### Changes to Step and Solve 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; typedef struct coordinate Coordinate; typedef struct cube Cube; typedef struct dfsarg DfsArg; +typedef struct fstcube FstCube; typedef struct indexer Indexer; typedef struct movable Movable; typedef struct moveset Moveset; @@ -225,6 +226,21 @@ dfsarg void * extra; }; +struct +fstcube +{ + uint16_t uf_eofb; + uint16_t uf_eposepe; + uint16_t uf_coud; + uint16_t uf_cp; + uint16_t fr_eofb; + uint16_t fr_eposepe; + uint16_t fr_coud; + uint16_t rd_eofb; + uint16_t rd_eposepe; + uint16_t rd_coud; +} + struct indexer { 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 @@ +#define FST_C + +#include "fst.h" + +static void fst_to_ep(FstCube fst, int *ep); + +FstCube +cube_to_fst(Cube *cube) +{ + Cube c; + FstCube ret; + + copy_cube(cube, &c); + ret.uf_eofb = index_eofb(&c); + ret.uf_eposepe = index_eposepe(&c); + ret.uf_coud = index_coud(&c); + ret.uf_cp = index_cp(&c); + copy_cube(cube, &c); + transform_cube(fr, &c); + ret.fr_eofb = index_eofb(&c); + ret.fr_eposepe = index_eposepe(&c); + ret.fr_coud = index_coud(&c); + transform_cube(rd, &c); + ret.rd_eofb = index_eofb(&c); + ret.rd_eposepe = index_eposepe(&c); + ret.rd_coud = index_coud(&c); + + return ret; +} + +FstCube +fst_inverse(FstCube fst) +{ + /* TODO */ +} + +FstCube +fst_move(Move m, FstCube fst) +{ + /* TODO */ +} + +void +fst_to_cube(FstCube fst, Cube *cube) +{ + invindex_eofb((uint64_t)fst.uf_eofb, cube); + fst_to_ep(fst, cube->ep); + invindex_coud((uint64_t)fst.uf_coud, cube); + invindex_cp((uint64_t)fst.uf_cp, cube); +} + +static void +fst_to_ep(FstCube fst, int *ep) +{ + /* TODO */ +} + +#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 @@ +#ifndef FST_H +#define FST_H + +#include "coord.h" + +FstCube cube_to_fst(Cube *cube); +FstCube fst_inverse(FstCube fst); +FstCube fst_move(Move m, FstCube fst); +void fst_to_cube(FstCube fst, Cube *cube); + +#endif + -- cgit v1.3