Project

General

Profile

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

distorted-objectlib / src / main / java / org / distorted / objectlib / objects / TwistyBandagedGeneric.java @ 1d581993

1 5f54927b Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
2
// Copyright 2021 Leszek Koltunski                                                               //
3
//                                                                                               //
4
// This file is part of Magic Cube.                                                              //
5
//                                                                                               //
6
// Magic Cube is free software: you can redistribute it and/or modify                            //
7
// it under the terms of the GNU General Public License as published by                          //
8
// the Free Software Foundation, either version 2 of the License, or                             //
9
// (at your option) any later version.                                                           //
10
//                                                                                               //
11
// Magic Cube is distributed in the hope that it will be useful,                                 //
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of                                //
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the                                 //
14
// GNU General Public License for more details.                                                  //
15
//                                                                                               //
16
// You should have received a copy of the GNU General Public License                             //
17
// along with Magic Cube.  If not, see <http://www.gnu.org/licenses/>.                           //
18
///////////////////////////////////////////////////////////////////////////////////////////////////
19
20
package org.distorted.objectlib.objects;
21
22
import org.distorted.library.type.Static3D;
23
import org.distorted.library.type.Static4D;
24 1d581993 Leszek Koltunski
import org.distorted.objectlib.helpers.ObjectSignature;
25 0e311558 Leszek Koltunski
import org.distorted.objectlib.scrambling.ScrambleState;
26 5f54927b Leszek Koltunski
27
import java.io.InputStream;
28
29
///////////////////////////////////////////////////////////////////////////////////////////////////
30
31
public class TwistyBandagedGeneric extends TwistyBandagedAbstract
32
{
33 e85c8f90 Leszek Koltunski
  private static float[][] POS;
34 1d581993 Leszek Koltunski
  private static ObjectSignature mSignature;
35 5f54927b Leszek Koltunski
36
///////////////////////////////////////////////////////////////////////////////////////////////////
37
38 3bf19410 Leszek Koltunski
  public TwistyBandagedGeneric(int[] numL, int meshState, int iconMode, Static4D quat, Static3D move, float scale, InputStream stream)
39 5f54927b Leszek Koltunski
    {
40 3bf19410 Leszek Koltunski
    super(numL, meshState, iconMode, quat, move, scale, stream);
41 5f54927b Leszek Koltunski
    }
42
43
///////////////////////////////////////////////////////////////////////////////////////////////////
44 b1f0d55d Leszek Koltunski
// Computing scramble states of many a bandaged cubes takes way too long time and too much space.
45 0e311558 Leszek Koltunski
// Return null here and turn to construction of scramble tables just-in-time.
46
47
  @Override
48
  public ScrambleState[] getScrambleStates()
49
    {
50
    return null;
51
    }
52
53
///////////////////////////////////////////////////////////////////////////////////////////////////
54
55
  @Override
56
  public int getScrambleType()
57
    {
58
    return 2;
59
    }
60
61 e85c8f90 Leszek Koltunski
///////////////////////////////////////////////////////////////////////////////////////////////////
62
63
  public static void setPositions(float[][] positions)
64
    {
65
    POS = positions;
66 1d581993 Leszek Koltunski
    mSignature = null;
67 5f54927b Leszek Koltunski
    }
68
69
///////////////////////////////////////////////////////////////////////////////////////////////////
70
71
  float[][] getPositions()
72
    {
73 e85c8f90 Leszek Koltunski
    if( POS==null )
74 5f54927b Leszek Koltunski
      {
75 e85c8f90 Leszek Koltunski
      POS = new float[][]
76 5f54927b Leszek Koltunski
        {
77 f9e28248 Leszek Koltunski
          {-1.0f, +1.0f, +1.0f},
78
          {-1.0f, +1.0f, -1.0f},
79
          {-1.0f, -1.0f, +1.0f},
80
          {-1.0f, -1.0f, -1.0f},
81 5f54927b Leszek Koltunski
          { 1.0f, +1.0f, -1.0f},
82 f9e28248 Leszek Koltunski
          { 1.0f,  1.0f,  1.0f},
83
          { 1.0f, -1.0f, +1.0f},
84
          { 1.0f, -1.0f, -1.0f},
85 cc70f525 Leszek Koltunski
86
          {-1.0f, +1.0f, +0.0f,
87
           -1.0f,  0.0f, +1.0f,
88
           -1.0f,  0.0f, +0.0f,
89
           -1.0f,  0.0f, -1.0f,
90
           -1.0f, -1.0f, +0.0f,
91
            0.0f, -1.0f, +1.0f,
92
            0.0f, -1.0f, +0.0f,
93
            0.0f, +1.0f, +1.0f,
94
            0.0f, +1.0f, +0.0f,
95
            0.0f, +1.0f, -1.0f,
96
            0.0f,  0.0f, +1.0f,
97
            0.0f,  0.0f, -1.0f,
98
            1.0f, +1.0f, +0.0f,
99
            1.0f, +0.0f, +1.0f,
100
            1.0f,  0.0f, +0.0f,
101
            1.0f,  0.0f, -1.0f,
102
            1.0f, -1.0f, +0.0f,
103
            0.0f, -1.0f, -1.0f},
104 5f54927b Leszek Koltunski
        };
105
      }
106 e85c8f90 Leszek Koltunski
    return POS;
107 5f54927b Leszek Koltunski
    }
108
109
///////////////////////////////////////////////////////////////////////////////////////////////////
110
// PUBLIC APi
111
112
  public String getShortName()
113
    {
114 1d581993 Leszek Koltunski
    if( mSignature==null ) mSignature = getSignature();
115
    int[] numLayers = getNumLayers();
116
    int number = 100*numLayers[0]+10*numLayers[1]+numLayers[0];
117
118
    return number+"_"+mSignature.getString();
119 5f54927b Leszek Koltunski
    }
120
121
///////////////////////////////////////////////////////////////////////////////////////////////////
122
123 1d581993 Leszek Koltunski
  public ObjectSignature getSignature()
124 5f54927b Leszek Koltunski
    {
125 1d581993 Leszek Koltunski
    if( mSignature==null )
126 e85c8f90 Leszek Koltunski
      {
127 1d581993 Leszek Koltunski
      int[] numLayers = getNumLayers();
128
      mSignature = new ObjectSignature(numLayers[0],numLayers[1],numLayers[2],POS);
129 e85c8f90 Leszek Koltunski
      }
130 5f54927b Leszek Koltunski
    return mSignature;
131
    }
132
133
///////////////////////////////////////////////////////////////////////////////////////////////////
134
135
  public String getObjectName()
136
    {
137
    return "";
138
    }
139
140
///////////////////////////////////////////////////////////////////////////////////////////////////
141
142
  public String getInventor()
143
    {
144
    return "??";
145
    }
146
147
///////////////////////////////////////////////////////////////////////////////////////////////////
148
149
  public int getYearOfInvention()
150
    {
151
    return 0;
152
    }
153
154
///////////////////////////////////////////////////////////////////////////////////////////////////
155
156
  public int getComplexity()
157
    {
158
    return 4;
159
    }
160
161
///////////////////////////////////////////////////////////////////////////////////////////////////
162
163
  public String[][] getTutorials()
164
    {
165
    return null;
166
    }
167
}