Project

General

Profile

« Previous | Next » 

Revision b8519939

Added by Leszek Koltunski about 1 year ago

Pyraminx solver: progress

View differences:

src/main/java/org/distorted/objectlib/objects/TwistyPyraminx.java
32 32

  
33 33
public class TwistyPyraminx extends ShapeTetrahedron
34 34
{
35
  static final Static3D[] ROT_AXIS = new Static3D[]
35
  public static final Static3D[] ROT_AXIS = new Static3D[]
36 36
         {
37 37
           new Static3D(     0,-SQ3/3,-SQ6/3),
38 38
           new Static3D(     0,-SQ3/3, SQ6/3),
src/main/java/org/distorted/objectlib/tablebases/TablebasesPyraminx.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
import static org.distorted.objectlib.main.TwistyObject.SQ6;
14

  
15
import android.content.res.Resources;
16

  
17
import org.distorted.library.type.Static3D;
18
import org.distorted.objectlib.objects.TwistyPyraminx;
19

  
20
///////////////////////////////////////////////////////////////////////////////////////////////////
21

  
22
public class TablebasesPyraminx extends TablebasesAbstract
23
{
24
///////////////////////////////////////////////////////////////////////////////////////////////////
25

  
26
  public TablebasesPyraminx()
27
    {
28
    super();
29
    }
30

  
31
///////////////////////////////////////////////////////////////////////////////////////////////////
32

  
33
  public TablebasesPyraminx(Resources res)
34
    {
35
    super(res,org.distorted.objectlib.R.raw.pduo_2_tablebase);
36
    }
37

  
38
///////////////////////////////////////////////////////////////////////////////////////////////////
39

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

  
46
///////////////////////////////////////////////////////////////////////////////////////////////////
47

  
48
  Static3D[] getRotationAxis()
49
    {
50
    return TwistyPyraminx.ROT_AXIS;
51
    }
52

  
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54

  
55
  float[][] getPosition()
56
    {
57
    return new float[][]
58
         {
59
             { 0.0f,-SQ2/4, 0.5f},
60
             { 0.0f,-SQ2/4,-0.5f},
61
             {-0.5f, SQ2/4, 0.0f},
62
             { 0.5f, SQ2/4, 0.0f},
63

  
64
             { 0.0f,-SQ2/2, 0.0f},
65
             {-0.5f,  0.0f, 0.5f},
66
             {-0.5f,  0.0f,-0.5f},
67
             { 0.5f,  0.0f, 0.5f},
68
             { 0.5f,  0.0f,-0.5f},
69
             { 0.0f, SQ2/2, 0.0f},
70
         };
71
    }
72

  
73
///////////////////////////////////////////////////////////////////////////////////////////////////
74

  
75
  float[][] getCuts()
76
    {
77
    float[] cut = { 0.25f*(SQ6/3) };
78
    return new float[][] { cut,cut,cut,cut };
79
    }
80

  
81
///////////////////////////////////////////////////////////////////////////////////////////////////
82

  
83
  boolean[][] getRotatable()
84
    {
85
    boolean[] tmp = new boolean[] {false,true};
86
    return new boolean[][] { tmp,tmp,tmp,tmp };
87
    }
88

  
89
///////////////////////////////////////////////////////////////////////////////////////////////////
90
// specifically for the tablebase
91
///////////////////////////////////////////////////////////////////////////////////////////////////
92

  
93
  int getSize()
94
    {
95
    return 933120;  // see https://www.jaapsch.net/puzzles/pyraminx.htm
96
    }
97

  
98
///////////////////////////////////////////////////////////////////////////////////////////////////
99

  
100
  int[] getQuats(int index)
101
    {
102
    return new int[] {0,0,0,0, 0,0,0,0,0,0};
103
    }
104

  
105
///////////////////////////////////////////////////////////////////////////////////////////////////
106

  
107
  int getIndex(int[] quats)
108
    {
109
    return 0;
110
    }
111
}  
112

  

Also available in: Unified diff