nissy-fmc

A Rubik's cube FMC assistant
git clone https://git.tronto.net/nissy-fmc
Download | Log | Files | Refs | README | LICENSE

coord.h (1628B)


      1 #define ENTRIES_PER_GROUP         (2*sizeof(entry_group_t))
      2 #define ENTRIES_PER_GROUP_COMPACT (4*sizeof(entry_group_t))
      3 
      4 typedef uint8_t entry_group_t;
      5 typedef uint32_t coord_value_t;
      6 typedef bool (Moveset)(Move);
      7 typedef enum { COMP_COORD, SYM_COORD, SYMCOMP_COORD } CoordType;
      8 typedef struct {
      9 	int n;
     10 	coord_value_t (*index)(Cube *);
     11 	void (*to_cube)(coord_value_t, Cube *);
     12 } Indexer;
     13 typedef struct coordinate {
     14 	char *name;
     15 	CoordType type;
     16 	coord_value_t max;
     17 	coord_value_t *mtable[NMOVES_HTM];
     18 	coord_value_t *ttable[NTRANS];
     19 	TransGroup *tgrp;
     20 	struct coordinate *base[2];
     21 
     22 	coord_value_t *symclass;
     23 	coord_value_t *symrep;
     24 	Trans *transtorep;
     25 	Trans *ttrep_move[NMOVES_HTM];
     26 
     27 	bool generated;
     28 	Indexer *i[99];
     29 	coord_value_t *selfsim;
     30 
     31 	Moveset *moveset;
     32 	coord_value_t updated;
     33 	entry_group_t *ptable;
     34 	int8_t ptablebase;
     35 	bool compact;
     36 	coord_value_t count[16];
     37 } Coordinate;
     38 
     39 coord_value_t indexers_getind(Indexer **, Cube *);
     40 coord_value_t indexers_getmax(Indexer **);
     41 void indexers_makecube(Indexer **, coord_value_t, Cube *);
     42 
     43 void alloc_sd(Coordinate *, bool);
     44 void alloc_mtable(Coordinate *);
     45 void alloc_ttrep_move(Coordinate *);
     46 void alloc_ttable(Coordinate *);
     47 void alloc_ptable(Coordinate *, bool);
     48 
     49 coord_value_t index_coord(Coordinate *, Cube *, Trans *);
     50 coord_value_t move_coord(Coordinate *, Move, coord_value_t, Trans *);
     51 coord_value_t trans_coord(Coordinate *, Trans, coord_value_t);
     52 
     53 int ptableval(Coordinate *, coord_value_t);
     54 size_t ptablesize(Coordinate *);
     55 void ptableupdate(Coordinate *, coord_value_t, int);
     56 
     57 size_t read_coord(Coordinate *, char *);
     58 size_t write_coord(Coordinate *, char *);