Project

General

Profile

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

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

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 static org.distorted.objectlib.main.TwistyObject.SQ3;
13

    
14
import android.content.res.Resources;
15

    
16
import org.distorted.library.type.Static3D;
17

    
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19

    
20
public class TBDino6 extends TablebasesAbstract
21
{
22
///////////////////////////////////////////////////////////////////////////////////////////////////
23

    
24
  public TBDino6()
25
    {
26
    super();
27
    }
28

    
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30

    
31
  public TBDino6(Resources res)
32
    {
33
    super(res,org.distorted.objectlib.R.raw.pduo_2_tablebase);
34
    }
35

    
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37

    
38
  int[][] getBasicAngles()
39
    {
40
    int[] tmp = {3,3,3};
41
    return new int[][] { tmp,tmp,tmp,tmp };
42
    }
43

    
44
///////////////////////////////////////////////////////////////////////////////////////////////////
45

    
46
  Static3D[] getRotationAxis()
47
    {
48
    return new Static3D[]
49
         {
50
           new Static3D( SQ3/3, SQ3/3, SQ3/3),
51
           new Static3D( SQ3/3, SQ3/3,-SQ3/3),
52
           new Static3D( SQ3/3,-SQ3/3, SQ3/3),
53
           new Static3D( SQ3/3,-SQ3/3,-SQ3/3)
54
         };
55
    }
56

    
57
///////////////////////////////////////////////////////////////////////////////////////////////////
58

    
59
  float[][] getPosition()
60
    {
61
    return new float[][]
62
         {
63
             { 0.0f, 1.5f, 1.5f },
64
             { 1.5f, 0.0f, 1.5f },
65
             { 0.0f,-1.5f, 1.5f },
66
             {-1.5f, 0.0f, 1.5f },
67
             { 1.5f, 1.5f, 0.0f },
68
             { 1.5f,-1.5f, 0.0f },
69
             {-1.5f,-1.5f, 0.0f },
70
             {-1.5f, 1.5f, 0.0f },
71
             { 0.0f, 1.5f,-1.5f },
72
             { 1.5f, 0.0f,-1.5f },
73
             { 0.0f,-1.5f,-1.5f },
74
             {-1.5f, 0.0f,-1.5f }
75
         };
76
    }
77

    
78
///////////////////////////////////////////////////////////////////////////////////////////////////
79

    
80
  float[][] getCuts()
81
    {
82
    float[] cut = new float[] { -SQ3/3, SQ3/3 };
83
    return new float[][] { cut,cut,cut,cut };
84
    }
85

    
86
///////////////////////////////////////////////////////////////////////////////////////////////////
87

    
88
  boolean[][] getRotatable()
89
    {
90
    boolean[] tmp = new boolean[] {true,false,true};
91
    return new boolean[][] { tmp,tmp,tmp,tmp };
92
    }
93

    
94
///////////////////////////////////////////////////////////////////////////////////////////////////
95
// specifically for the tablebase
96
///////////////////////////////////////////////////////////////////////////////////////////////////
97

    
98
  int getSize()
99
    {
100
    return 19958400;  // see https://www.jaapsch.net/puzzles/dinocube.htm
101
    }
102

    
103
///////////////////////////////////////////////////////////////////////////////////////////////////
104

    
105
  int getMinScramble()
106
    {
107
    return 9;
108
    }
109

    
110
///////////////////////////////////////////////////////////////////////////////////////////////////
111

    
112
  public static int getIndexFromPerm(int[] perm)
113
    {
114
    int[] perm11 = new int[11];
115
    for(int i=0; i<11; i++) perm11[i] = perm[i+1]-1;
116
    return TablebaseHelpers.computeEvenPermutationNum(perm11);
117
    }
118

    
119
///////////////////////////////////////////////////////////////////////////////////////////////////
120

    
121
  private int[] getPermFromQuats(int[] quats)
122
    {
123
    return null;  // TODO
124
    }
125

    
126
///////////////////////////////////////////////////////////////////////////////////////////////////
127

    
128
  private int[] getQuatsFromPerm(int[] perm)
129
    {
130
    return null;  // TODO
131
    }
132

    
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134

    
135
  int[] getQuats(int index)
136
    {
137
    int[] perm11 = new int[11];
138
    TablebaseHelpers.getEvenPermutationFromNum(perm11,index);
139
    int[] perm = new int[12];
140
    for(int i=1; i<12; i++) perm[i] = perm11[i-1]+1;
141
    return getQuatsFromPerm(perm);
142
    }
143

    
144
///////////////////////////////////////////////////////////////////////////////////////////////////
145

    
146
  int getIndex(int[] quats)
147
    {
148
    int[] perm = getPermFromQuats(quats);
149
    return getIndexFromPerm(perm);
150
    }
151
}  
152

    
(5-5/15)