Project

General

Profile

« Previous | Next » 

Revision 86bdcff5

Added by Leszek Koltunski about 1 year ago

Skeleton of a Pyraminx Diamond solver.

View differences:

src/main/java/org/distorted/objectlib/tablebases/ImplementedTablebasesList.java
31 31
  SKEW2    (ObjectSignatures.SKEW_2, TBSkewb.class),
32 32
  DINO6    (ObjectSignatures.DINO_3, TBDino6.class),
33 33
  DINO4    (ObjectSignatures.DIN4_3, TBDino4.class),
34
  PDIAM    (ObjectSignatures.PDIA_3, TBPyraminxDiamond.class),
34 35
  ;
35 36

  
36 37
  public static final int NUM_OBJECTS = values().length;
src/main/java/org/distorted/objectlib/tablebases/TBPyraminxDiamond.java
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.SQ2;
13

  
14
import android.content.res.Resources;
15

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

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

  
20
public class TBPyraminxDiamond extends TablebasesAbstract
21
{
22
  public TBPyraminxDiamond()
23
    {
24
    super();
25
    }
26

  
27
///////////////////////////////////////////////////////////////////////////////////////////////////
28

  
29
  public TBPyraminxDiamond(Resources res)
30
    {
31
    super(res, 0);
32
    }
33

  
34
///////////////////////////////////////////////////////////////////////////////////////////////////
35

  
36
  int[][] getBasicAngles()
37
    {
38
    int[] tmp = {4,4,4};
39
    return new int[][] { tmp,tmp,tmp };
40
    }
41

  
42
///////////////////////////////////////////////////////////////////////////////////////////////////
43

  
44
  Static3D[] getRotationAxis()
45
    {
46
    return new Static3D[]
47
         {
48
         new Static3D(SQ2/2, 0, SQ2/2),
49
         new Static3D(    0, 1,     0),
50
         new Static3D(SQ2/2, 0,-SQ2/2)
51
         };
52
    }
53

  
54
///////////////////////////////////////////////////////////////////////////////////////////////////
55

  
56
  float[][] getPosition()
57
    {
58
    float B0 = 1.5f*SQ2;
59
    float C0 = 1.5f;
60
    float A  = 1.03f;
61
    float B1 = 0.5f*SQ2*A;
62
    float C1 = A;
63

  
64
    return new float[][]
65
         {
66
             {  0, B0,  0 },
67
             {  0,-B0,  0 },
68
             { C0,  0, C0 },
69
             { C0,  0,-C0 },
70
             {-C0,  0, C0 },
71
             {-C0,  0,-C0 },
72

  
73
             {  0, B1, C1 },
74
             {  0, B1,-C1 },
75
             {  0,-B1, C1 },
76
             {  0,-B1,-C1 },
77
             { C1, B1,  0 },
78
             { C1,-B1,  0 },
79
             {-C1, B1,  0 },
80
             {-C1,-B1,  0 },
81
         };
82
    }
83

  
84
///////////////////////////////////////////////////////////////////////////////////////////////////
85

  
86
  float[][] getCuts()
87
    {
88
    float C = 0.5f*SQ2;
89
    float[] cut = { -C,C};
90
    return new float[][] { cut,cut,cut };
91
    }
92

  
93
///////////////////////////////////////////////////////////////////////////////////////////////////
94

  
95
  boolean[][] getRotatable()
96
    {
97
    boolean[] tmp = {true,false,true};
98
    return new boolean[][] { tmp,tmp,tmp };
99
    }
100

  
101
///////////////////////////////////////////////////////////////////////////////////////////////////
102
// specifically for the tablebase
103
///////////////////////////////////////////////////////////////////////////////////////////////////
104
// 4^6 - corner twists; 8! - center permutation; divide by 2 because parity of permutation must
105
// agree with parity of total twists = (4^6)*8! / 2 = 82.575.360
106

  
107
  int getSize()
108
    {
109
    return 82575360;
110
    }
111

  
112
///////////////////////////////////////////////////////////////////////////////////////////////////
113

  
114
  int getMinScramble()
115
    {
116
    return 8;
117
    }
118

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

  
121
  public int[] getQuats(int index)
122
    {
123
    return null;
124
    }
125

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

  
128
  public int getIndex(int[] quats)
129
    {
130
    return 0;
131
    }
132
}  
133

  

Also available in: Unified diff