cubecore

A library of core functions for working with 3x3x3 Rubik's cubes
git clone https://git.tronto.net/cubecore
Download | Log | Files | Refs | README | LICENSE

cube.h (1155B)


      1 typedef enum {
      2 	U, U2, U3, D, D2, D3,
      3 	R, R2, R3, L, L2, L3,
      4 	F, F2, F3, B, B2, B3
      5 } move_t;
      6 
      7 typedef enum {
      8 	UFr, ULr, UBr, URr, DFr, DLr, DBr, DRr,
      9 	RUr, RFr, RDr, RBr, LUr, LFr, LDr, LBr,
     10 	FUr, FRr, FDr, FLr, BUr, BRr, BDr, BLr,
     11 
     12 	UFm, ULm, UBm, URm, DFm, DLm, DBm, DRm,
     13 	RUm, RFm, RDm, RBm, LUm, LFm, LDm, LBm,
     14 	FUm, FRm, FDm, FLm, BUm, BRm, BDm, BLm
     15 } trans_t;
     16 
     17 typedef struct {
     18 	uint8_t corner[8];
     19 	uint8_t edge[12];
     20 } cube_t;
     21 
     22 cube_t cube_new(void);
     23 cube_t cube_clone(cube_t);
     24 bool cube_consistent(cube_t);
     25 bool cube_solvable(cube_t);
     26 bool cube_solved(cube_t);
     27 bool cube_equal(cube_t, cube_t);
     28 bool cube_error(cube_t);
     29 cube_t cube_compose(cube_t, cube_t);
     30 cube_t cube_inverse(cube_t);
     31 cube_t cube_move(cube_t, move_t);
     32 cube_t cube_transform(cube_t, trans_t);
     33 
     34 int64_t cube_coord_co(cube_t);
     35 int64_t cube_coord_eo(cube_t);
     36 
     37 cube_t cube_read(const char *format, const char *buf);
     38 void cube_write(const char *format, cube_t cube, char *buf);
     39 int cube_readmoves(const char *, move_t *);
     40 char *cube_movestr(move_t);
     41 trans_t cube_readtrans(const char *);
     42 char *cube_transstr(trans_t);
     43 move_t cube_inversemove(move_t);
     44 trans_t cube_inversetrans(trans_t);