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

drfinnoe.h (2662B)


      1 /*
      2 TODO
      3 
      4 The pruning table for this coordinate shows some odd behavior, which
      5 is actually also present in nissy-classic: after completing depth 14,
      6 if the search is let run for higher depth, no more positions are found.
      7 This could be as simple as a small bug in the logic of the pruning table
      8 calculations - I may be assuming somewhere that I am never going to search
      9 for depths >= 15, since they are the highest possible value anyway -
     10 or some reason related to symmetry - are some cases actually impossible?
     11 In the worst case, it is a bug to be fixed, but I find it unlikely.
     12 */
     13 
     14 #define CLASSES_CP_16 2768
     15 
     16 STATIC uint64_t coordinate_drfinnoe_coord(cube_t, const unsigned char *);
     17 STATIC cube_t coordinate_drfinnoe_cube(uint64_t, const unsigned char *);
     18 STATIC bool coordinate_drfinnoe_isnasty(uint64_t, const unsigned char *);
     19 STATIC size_t coordinate_drfinnoe_gendata(unsigned char *);
     20 
     21 STATIC bool is_drfinnoe_solvable(cube_t);
     22 
     23 STATIC coord_t coordinate_drfinnoe = {
     24 	.name = "DRFINNOE",
     25 	.coord = &coordinate_drfinnoe_coord,
     26 	.cube = &coordinate_drfinnoe_cube,
     27 	.isnasty = &coordinate_drfinnoe_isnasty,
     28 	.gendata = coordinate_drfinnoe_gendata,
     29 	.max = CLASSES_CP_16 * FACT_8,
     30 	.trans_mask = TM_UDFIX,
     31 	.moves_mask_gendata = MM18_DR,
     32 	.moves_mask_solve = MM18_DR,
     33 	.is_admissible = &solution_always_valid,
     34 	.solution_prune = NULL,
     35 	.is_solvable = &is_drfinnoe_solvable,
     36 	.is_solved = NULL,
     37 	.allow_niss = false,
     38 	.pruning_distribution = {
     39  		[0] = 1,
     40 		[1] = 3,
     41 		[2] = 10,
     42 		[3] = 52,
     43 		[4] = 285,
     44 		[5] = 1318,
     45 		[6] = 5671,
     46 		[7] = 26502,
     47 		[8] = 115467,
     48 		[9] = 470846,
     49 		[10] = 1853056,
     50 		[11] = 6535823,
     51 		[12] = 18349792,
     52 		[13] = 32843350,
     53 		[14] = 34118883,
     54 		[15] = 17284701
     55 	},
     56 	.pruning_max = 15,
     57 	.sym = {
     58 		.classes = CLASSES_CP_16,
     59 		.max = FACT_8,
     60 		.coord = &coord_cp,
     61 		.cube = &invcoord_cp,
     62 		.max2 = FACT_8,
     63 		.coord2 = &coord_epud,
     64 		.cube2 = &invcoord_epud,
     65 		.merge = &coordinate_merge_ce,
     66 	},
     67 };
     68 
     69 STATIC uint64_t
     70 coordinate_drfinnoe_coord(cube_t cube, const unsigned char *data)
     71 {
     72 	return coord_coord_generic(&coordinate_drfinnoe, cube, data);
     73 }
     74 
     75 STATIC cube_t
     76 coordinate_drfinnoe_cube(uint64_t i, const unsigned char *data)
     77 {
     78 	return coord_cube_generic(&coordinate_drfinnoe, i, data);
     79 }
     80 
     81 STATIC bool
     82 coordinate_drfinnoe_isnasty(uint64_t i, const unsigned char *data)
     83 {
     84 	return coord_isnasty_generic(&coordinate_drfinnoe, i, data);
     85 }
     86 
     87 STATIC size_t
     88 coordinate_drfinnoe_gendata(unsigned char *data)
     89 {
     90 	return coord_gendata_generic(&coordinate_drfinnoe, data);
     91 }
     92 
     93 STATIC bool
     94 is_drfinnoe_solvable(cube_t cube) {
     95 	return coord_eo(cube) == 0 &&
     96 	       coord_eo(transform_edges(cube, TRANS_URr)) == 0 &&
     97 	       coord_co(cube) == 0;
     98 }