Project

General

Profile

Download (3.92 KB) Statistics
| Branch: | Revision:

distorted-objectlib / src / main / java / org / distorted / objectlib / tablebases / TBDino6.java @ 398f2870

1 76de8309 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
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 5b9f1cec Leszek Koltunski
import org.distorted.objectlib.R;
13 3103c3c8 Leszek Koltunski
import org.distorted.objectlib.helpers.OperatingSystemInterface;
14 76de8309 Leszek Koltunski
15
///////////////////////////////////////////////////////////////////////////////////////////////////
16
17 a76bb8f6 Leszek Koltunski
public class TBDino6 extends TBDino
18 76de8309 Leszek Koltunski
{
19 a76bb8f6 Leszek Koltunski
  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 5b9f1cec Leszek Koltunski
22 76de8309 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
23
24
  public TBDino6()
25
    {
26
    super();
27
    }
28
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30
31 3103c3c8 Leszek Koltunski
  public TBDino6(OperatingSystemInterface os)
32 76de8309 Leszek Koltunski
    {
33 3103c3c8 Leszek Koltunski
    super(os,new int[] {R.raw.dino_3_pruning3,R.raw.dino_3_pruning4},new int[] {R.raw.dino_3_pruning10});
34 76de8309 Leszek Koltunski
    }
35
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37
// specifically for the tablebase
38 5b9f1cec Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
39
// two solved positions: original and mirrored (left face swapped with right)
40
41
  @Override
42
  int[] getSolvedIndices()
43
    {
44 a76bb8f6 Leszek Koltunski
    return new int[] {SOLVED1,SOLVED2};
45 5b9f1cec Leszek Koltunski
    }
46
47
///////////////////////////////////////////////////////////////////////////////////////////////////
48
// ditto
49
50
  @Override
51
  boolean isSolved(int index)
52
    {
53 a76bb8f6 Leszek Koltunski
    return index==SOLVED1 || index==SOLVED2;
54 5b9d6595 Leszek Koltunski
    }
55
56
///////////////////////////////////////////////////////////////////////////////////////////////////
57 76de8309 Leszek Koltunski
58
  int getSize()
59
    {
60
    return 19958400;  // see https://www.jaapsch.net/puzzles/dinocube.htm
61
    }
62
63
///////////////////////////////////////////////////////////////////////////////////////////////////
64
65
  int getMinScramble()
66
    {
67 5b9f1cec Leszek Koltunski
    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 76de8309 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
92
93
  public static int getIndexFromPerm(int[] perm)
94
    {
95 ef93065b Leszek Koltunski
    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 76de8309 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
101
102
  int[] getQuats(int index)
103
    {
104 ef93065b Leszek Koltunski
    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 76de8309 Leszek Koltunski
    }
110
111
///////////////////////////////////////////////////////////////////////////////////////////////////
112
113
  int getIndex(int[] quats)
114
    {
115 9e7ff8d2 Leszek Koltunski
    normalizeQuats(quats);
116 ef93065b Leszek Koltunski
    int[] perm = getPermFromQuats(quats);
117 0cb18c32 Leszek Koltunski
    return getIndexFromPerm(perm);
118 76de8309 Leszek Koltunski
    }
119
}