nissy

Where is nissy?
git clone https://git.tronto.net/nissy
Download | Log | Files | Refs | README

commit 2dce2a8a0ebd95e9e65d9d53206c4b2babc2af2f
parent 86dd040a2d2f06e8355f5441fb1da5ed59ecc399
Author: Sebastiano Tronto <sebastiano@tronto.net>
Date:   Sat, 10 Sep 2022 19:13:02 +0200

Added fst_cube prototypes

Diffstat:
MTODO.md | 13++++++-------
Msrc/cubetypes.h | 16++++++++++++++++
Asrc/fst.c | 58++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Asrc/fst.h | 12++++++++++++
4 files changed, 92 insertions(+), 7 deletions(-)

diff --git 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 @@ -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; @@ -226,6 +227,21 @@ dfsarg }; 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 { int n; diff --git a/src/fst.c 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 @@ -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 +