Project

General

Profile

« Previous | Next » 

Revision e4733ed7

Added by Leszek Koltunski over 2 years ago

New, generic bandaged 3x3 class 'TwistyBandagedAbstract'.

Now, (almost!) any bandaged 3x3 can be created by extending this class and implementing one abstract method 'getPositions()'. Almost, because there's still one restriction: currently all cubits need to be one of the 5 allowed types: 1x1x1, 2x1x1, 3x1x1, 2x2x1, 2x2x2.

Still, two missing 'TODOs' need to be implemented for truly 'any' bandaged cube to be supported.

View differences:

src/main/java/org/distorted/objects/RubikObjectList.java
24 24
import android.content.SharedPreferences;
25 25

  
26 26
import org.distorted.main.RubikActivity;
27
import org.distorted.objectlib.main.ObjectConstants;
27
import org.distorted.objectlib.main.ObjectSignatures;
28 28
import org.distorted.objectlib.main.ObjectType;
29 29
import org.distorted.screens.RubikScreenPlay;
30 30
import org.distorted.screens.ScreenList;
......
37 37

  
38 38
public class RubikObjectList
39 39
{
40
  public static final int DEF_OBJECT= ObjectConstants.CUBE_3;
40
  public static final int DEF_OBJECT= ObjectSignatures.CUBE_3;
41 41
  public static int MAX_LEVEL;
42 42

  
43 43
  private static RubikObjectList mThis;
......
164 164

  
165 165
  public static int getDBLevel(int ordinal)
166 166
    {
167
    if( ordinal==ObjectConstants.CUBE_3 ) return 16;
168
    if( ordinal==ObjectConstants.CUBE_4 ) return 20;
169
    if( ordinal==ObjectConstants.CUBE_5 ) return 24;
170
    if( ordinal==ObjectConstants.BAN2_3 ) return 16;
171
    if( ordinal==ObjectConstants.BAN4_3 ) return 16;
172
    if( ordinal==ObjectConstants.PYRA_4 ) return 15;
173
    if( ordinal==ObjectConstants.PYRA_5 ) return 20;
174
    if( ordinal==ObjectConstants.MEGA_5 ) return 35;
175
    if( ordinal==ObjectConstants.DIAM_2 ) return 10;
176
    if( ordinal==ObjectConstants.DIAM_3 ) return 18;
177
    if( ordinal==ObjectConstants.REDI_3 ) return 14;
178
    if( ordinal==ObjectConstants.HELI_3 ) return 18;
179
    if( ordinal==ObjectConstants.SKEW_3 ) return 17;
180
    if( ordinal==ObjectConstants.REX_3  ) return 16;
181
    if( ordinal==ObjectConstants.MIRR_3 ) return 16;
167
    if( ordinal== ObjectSignatures.CUBE_3 ) return 16;
168
    if( ordinal== ObjectSignatures.CUBE_4 ) return 20;
169
    if( ordinal== ObjectSignatures.CUBE_5 ) return 24;
170
    if( ordinal== ObjectSignatures.BAN2_3 ) return 16;
171
    if( ordinal== ObjectSignatures.BAN4_3 ) return 16;
172
    if( ordinal== ObjectSignatures.PYRA_4 ) return 15;
173
    if( ordinal== ObjectSignatures.PYRA_5 ) return 20;
174
    if( ordinal== ObjectSignatures.MEGA_5 ) return 35;
175
    if( ordinal== ObjectSignatures.DIAM_2 ) return 10;
176
    if( ordinal== ObjectSignatures.DIAM_3 ) return 18;
177
    if( ordinal== ObjectSignatures.REDI_3 ) return 14;
178
    if( ordinal== ObjectSignatures.HELI_3 ) return 18;
179
    if( ordinal== ObjectSignatures.SKEW_3 ) return 17;
180
    if( ordinal== ObjectSignatures.REX_3  ) return 16;
181
    if( ordinal== ObjectSignatures.MIRR_3 ) return 16;
182 182

  
183 183
    // in 1.9.6 & 1.9.7 there is a bug with downloadable objects (in this very function!):
184 184
    // All of those have DBLevel equal to CUBE_3's DBlevel (in 1.9.7!), i.e. 17.
src/main/java/org/distorted/patterns/RubikPatternList.java
19 19

  
20 20
package org.distorted.patterns;
21 21

  
22
import org.distorted.objectlib.main.ObjectConstants;
22
import org.distorted.objectlib.main.ObjectSignatures;
23 23

  
24 24
///////////////////////////////////////////////////////////////////////////////////////////////////
25 25

  
26 26
public enum RubikPatternList
27 27
  {
28
  CUBE2 (ObjectConstants.CUBE_2, PatternCube2.patterns),
29
  CUBE3 (ObjectConstants.CUBE_3, PatternCube3.patterns),
30
  CUBE4 (ObjectConstants.CUBE_4, PatternCube4.patterns),
31
  CUBE5 (ObjectConstants.CUBE_5, PatternCube5.patterns),
32
  PYRA3 (ObjectConstants.PYRA_3, PatternPyraminx3.patterns),
33
  PYRA4 (ObjectConstants.PYRA_4, PatternPyraminx4.patterns),
34
  PYRA5 (ObjectConstants.PYRA_5, PatternPyraminx5.patterns),
35
  MEGA3 (ObjectConstants.MEGA_3, PatternMegaminx.patterns),
36
  MEGA5 (ObjectConstants.MEGA_5, PatternGigaminx.patterns),
28
  CUBE2 (ObjectSignatures.CUBE_2, PatternCube2.patterns),
29
  CUBE3 (ObjectSignatures.CUBE_3, PatternCube3.patterns),
30
  CUBE4 (ObjectSignatures.CUBE_4, PatternCube4.patterns),
31
  CUBE5 (ObjectSignatures.CUBE_5, PatternCube5.patterns),
32
  PYRA3 (ObjectSignatures.PYRA_3, PatternPyraminx3.patterns),
33
  PYRA4 (ObjectSignatures.PYRA_4, PatternPyraminx4.patterns),
34
  PYRA5 (ObjectSignatures.PYRA_5, PatternPyraminx5.patterns),
35
  MEGA3 (ObjectSignatures.MEGA_3, PatternMegaminx.patterns),
36
  MEGA5 (ObjectSignatures.MEGA_5, PatternGigaminx.patterns),
37 37
  ;
38 38

  
39 39
  public static final int NUM_OBJECTS = values().length;
src/main/java/org/distorted/solvers/ImplementedSolversList.java
19 19

  
20 20
package org.distorted.solvers;
21 21

  
22
import org.distorted.objectlib.main.ObjectConstants;
22
import org.distorted.objectlib.main.ObjectSignatures;
23 23

  
24 24
///////////////////////////////////////////////////////////////////////////////////////////////////
25 25

  
26 26
public enum ImplementedSolversList
27 27
{
28
  CUBE3 (ObjectConstants.CUBE_3),
28
  CUBE3 (ObjectSignatures.CUBE_3),
29 29
  ;
30 30

  
31 31
  public static final int NUM_OBJECTS = values().length;
src/main/java/org/distorted/solvers/SolverMain.java
21 21

  
22 22
import android.content.res.Resources;
23 23

  
24
import org.distorted.objectlib.main.ObjectConstants;
24
import org.distorted.objectlib.main.ObjectSignatures;
25 25
import org.distorted.objectlib.main.TwistyObject;
26 26

  
27 27
import org.distorted.main.R;
......
53 53

  
54 54
  public static int cubitIsLocked(int object, int cubit)
55 55
    {
56
    if( object == ObjectConstants.CUBE_3 )
56
    if( object == ObjectSignatures.CUBE_3 )
57 57
      {
58 58
      if( cubit==20 ) return 0; // center of the right  face
59 59
      if( cubit==21 ) return 1; // center of the left   face
......
228 228
    {
229 229
    RubikScreenSolver solver = (RubikScreenSolver) ScreenList.SVER.getScreenClass();
230 230

  
231
    if( mSignature==ObjectConstants.CUBE_3 )
231
    if( mSignature== ObjectSignatures.CUBE_3 )
232 232
      {
233 233
      solveCube3(solver);
234 234
      }

Also available in: Unified diff