aboutsummaryrefslogtreecommitdiff
path: root/src/solvers/coord/eo.h
blob: a0685c4164881ebac3ea9adcd7dfa99bf19bf73f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
STATIC uint64_t coordinate_eo_coord(cube_t, const void *);
STATIC cube_t coordinate_eo_cube(uint64_t, const void *);
STATIC bool coordinate_eo_isnasty(uint64_t, const void *);
STATIC size_t coordinate_eo_gendata(void *);
STATIC bool is_eo_even(cube_t);

STATIC coord_t coordinate_eo = {
	.name = "EO",
	.coord = &coordinate_eo_coord,
	.cube = &coordinate_eo_cube,
	.isnasty = &coordinate_eo_isnasty,
	.gendata = coordinate_eo_gendata,
	.max = POW_2_11,
	.trans_mask = TM_SINGLE(TRANS_UFr),
	.moves_mask = MM_ALLMOVES,
	.axistrans = {
		[AXIS_UD] = TRANS_FDr,
		[AXIS_RL] = TRANS_URr,
		[AXIS_FB] = TRANS_UFr,
	},
	.is_admissible = &solution_lastqt_cw,
	.is_solvable = &is_eo_even,
	.sym = {0},
};

STATIC uint64_t
coordinate_eo_coord(cube_t c, const void *data)
{
	return (uint64_t)coord_eo(c);
}

STATIC cube_t
coordinate_eo_cube(uint64_t c, const void *data)
{
	cube_t cube = SOLVED_CUBE;
	set_eo(&cube, (int64_t)c);
	return cube;
}

STATIC bool
coordinate_eo_isnasty(uint64_t c, const void *data)
{
	return false;
}

STATIC size_t
coordinate_eo_gendata(void *data)
{
	return 0;
}

STATIC bool
is_eo_even(cube_t cube)
{
	uint8_t c[8], e[12], i, count;

	pieces(&cube, c, e);

	for (i = 0, count = 0; i < 12; i++)
		count += (e[i] & EOBIT) >> EOSHIFT;

	return count % 2 == 0;
}

Generated with cgit - Back to sebastiano.tronto.net