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