nissy-core

The "engine" of nissy, including the H48 optimal solver.
git clone https://git.tronto.net/nissy-core
Download | Log | Files | Refs | README | LICENSE

eo.h (1502B)


      1 STATIC uint64_t coordinate_eo_coord(cube_t, const unsigned char *);
      2 STATIC cube_t coordinate_eo_cube(uint64_t, const unsigned char *);
      3 STATIC bool coordinate_eo_isnasty(uint64_t, const unsigned char *);
      4 STATIC size_t coordinate_eo_gendata(unsigned char *);
      5 STATIC bool is_eo_even(cube_t);
      6 
      7 STATIC coord_t coordinate_eo = {
      8 	.name = "EO",
      9 	.coord = &coordinate_eo_coord,
     10 	.cube = &coordinate_eo_cube,
     11 	.isnasty = &coordinate_eo_isnasty,
     12 	.gendata = coordinate_eo_gendata,
     13 	.max = POW_2_11,
     14 	.trans_mask = TM_SINGLE(TRANS_UFr),
     15 	.moves_mask = MM18_ALLMOVES,
     16 	.axistrans = {
     17 		[AXIS_UD] = TRANS_FDr,
     18 		[AXIS_RL] = TRANS_URr,
     19 		[AXIS_FB] = TRANS_UFr,
     20 	},
     21 	.is_admissible = &solution_lastqt_cw,
     22 	.is_solvable = &is_eo_even,
     23 	.pruning_distribution = {
     24 		[0] = 1,
     25 		[1] = 2,
     26 		[2] = 25,
     27 		[3] = 202,
     28 		[4] = 620,
     29 		[5] = 900,
     30 		[6] = 285,
     31 		[7] = 13,
     32 	},
     33 	.pruning_max = 7,
     34 	.sym = {0},
     35 };
     36 
     37 STATIC uint64_t
     38 coordinate_eo_coord(cube_t c, const unsigned char *data)
     39 {
     40 	return (uint64_t)coord_eo(c);
     41 }
     42 
     43 STATIC cube_t
     44 coordinate_eo_cube(uint64_t c, const unsigned char *data)
     45 {
     46 	cube_t cube = SOLVED_CUBE;
     47 	set_eo(&cube, (int64_t)c);
     48 	return cube;
     49 }
     50 
     51 STATIC bool
     52 coordinate_eo_isnasty(uint64_t c, const unsigned char *data)
     53 {
     54 	return false;
     55 }
     56 
     57 STATIC size_t
     58 coordinate_eo_gendata(unsigned char *data)
     59 {
     60 	return 0;
     61 }
     62 
     63 STATIC bool
     64 is_eo_even(cube_t cube)
     65 {
     66 	uint8_t c[8], e[12], i, count;
     67 
     68 	pieces(&cube, c, e);
     69 
     70 	for (i = 0, count = 0; i < 12; i++)
     71 		count += (e[i] & EOBIT) >> EOSHIFT;
     72 
     73 	return count % 2 == 0;
     74 }