1
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
2
|
// Copyright 2023 Leszek Koltunski //
|
3
|
// //
|
4
|
// This file is part of Magic Cube. //
|
5
|
// //
|
6
|
// Magic Cube is proprietary software licensed under an EULA which you should have received //
|
7
|
// along with the code. If not, check https://distorted.org/magic/License-Magic-Cube.html //
|
8
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
9
|
|
10
|
package org.distorted.objectlib.tablebases;
|
11
|
|
12
|
import org.distorted.objectlib.R;
|
13
|
import org.distorted.objectlib.helpers.OperatingSystemInterface;
|
14
|
|
15
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
16
|
|
17
|
public class TBDino6 extends TBDino
|
18
|
{
|
19
|
private static final int SOLVED1 = 0;
|
20
|
private static final int SOLVED2 = 13379863; // quats (0,10,0,10, 11,11,11,11, 0,10,0,10)
|
21
|
|
22
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
23
|
|
24
|
public TBDino6()
|
25
|
{
|
26
|
super();
|
27
|
}
|
28
|
|
29
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
30
|
|
31
|
public TBDino6(OperatingSystemInterface os)
|
32
|
{
|
33
|
super(os,new int[] {R.raw.dino_3_pruning3,R.raw.dino_3_pruning4},new int[] {R.raw.dino_3_pruning10});
|
34
|
}
|
35
|
|
36
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
37
|
// specifically for the tablebase
|
38
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
39
|
// two solved positions: original and mirrored (left face swapped with right)
|
40
|
|
41
|
@Override
|
42
|
int[] getSolvedIndices()
|
43
|
{
|
44
|
return new int[] {SOLVED1,SOLVED2};
|
45
|
}
|
46
|
|
47
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
48
|
// ditto
|
49
|
|
50
|
@Override
|
51
|
boolean isSolved(int index)
|
52
|
{
|
53
|
return index==SOLVED1 || index==SOLVED2;
|
54
|
}
|
55
|
|
56
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
57
|
|
58
|
int getSize()
|
59
|
{
|
60
|
return 19958400; // see https://www.jaapsch.net/puzzles/dinocube.htm
|
61
|
}
|
62
|
|
63
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
64
|
|
65
|
int getMinScramble()
|
66
|
{
|
67
|
return 8;
|
68
|
}
|
69
|
|
70
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
71
|
|
72
|
int[] getMidPruningLevels()
|
73
|
{
|
74
|
return new int[] {3,4};
|
75
|
}
|
76
|
|
77
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
78
|
|
79
|
int[] getHighPruningLevels()
|
80
|
{
|
81
|
return new int[] {10};
|
82
|
}
|
83
|
|
84
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
85
|
|
86
|
int getGodsNumber()
|
87
|
{
|
88
|
return 10;
|
89
|
}
|
90
|
|
91
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
92
|
|
93
|
public static int getIndexFromPerm(int[] perm)
|
94
|
{
|
95
|
int[] perm11 = new int[11];
|
96
|
for(int i=0; i<11; i++) perm11[i] = perm[i+1]-1;
|
97
|
return TablebaseHelpers.computeEvenPermutationNum(perm11);
|
98
|
}
|
99
|
|
100
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
101
|
|
102
|
int[] getQuats(int index)
|
103
|
{
|
104
|
int[] perm11 = new int[11];
|
105
|
TablebaseHelpers.getEvenPermutationFromNum(perm11,index);
|
106
|
int[] perm = new int[12];
|
107
|
for(int i=1; i<12; i++) perm[i] = perm11[i-1]+1;
|
108
|
return getQuatsFromPerm(perm);
|
109
|
}
|
110
|
|
111
|
///////////////////////////////////////////////////////////////////////////////////////////////////
|
112
|
|
113
|
int getIndex(int[] quats)
|
114
|
{
|
115
|
normalizeQuats(quats);
|
116
|
int[] perm = getPermFromQuats(quats);
|
117
|
return getIndexFromPerm(perm);
|
118
|
}
|
119
|
}
|
120
|
|