Project

General

Profile

« Previous | Next » 

Revision e8d06619

Added by Leszek Koltunski 13 days ago

Progress with PhasedSolver app.

View differences:

src/main/java/org/distorted/phasedsolver/SolverActivity.java
25 25

  
26 26
import org.distorted.library.main.DistortedLibrary;
27 27
import org.distorted.objectlib.algsolvers.*;
28
import org.distorted.objectlib.algsolvers.implemented.Solver3x3Beginner;
28
import org.distorted.objectlib.algsolvers.implemented.PhasedSolverList;
29 29
import org.distorted.objectlib.algsolvers.implemented.SolverAbstract;
30
import org.distorted.objectlib.algsolvers.implemented.SolverKilominx;
31 30
import org.distorted.objectlib.main.InitAssets;
32 31
import org.distorted.objectlib.main.ObjectControl;
33 32
import org.distorted.objectlib.main.TwistyObject;
34
import org.distorted.objectlib.metadata.ListObjects;
35 33
import org.distorted.os.OSInterface;
36 34

  
37 35
///////////////////////////////////////////////////////////////////////////////////////////////////
......
140 138

  
141 139
  private String[] createSolverNames()
142 140
    {
143
    return new String[] {"3x3", "Kilo"};
141
    int num = PhasedSolverList.NUM_OBJECTS;
142
    String[] ret = new String[num];
143
    for(int s=0; s<num; s++) ret[s] = PhasedSolverList.getName(s);
144
    return ret;
144 145
    }
145 146

  
146 147
///////////////////////////////////////////////////////////////////////////////////////////////////
147 148

  
148 149
  private int getObjectOrdinal()
149 150
    {
150
    if( mCurrSolver==1 ) return ListObjects.KILO_3.ordinal();
151
    return ListObjects.CUBE_3.ordinal();
151
    return PhasedSolverList.getPuzzleOrdinal(mCurrSolver);
152 152
    }
153 153

  
154 154
///////////////////////////////////////////////////////////////////////////////////////////////////
155 155

  
156 156
  private String[] createSolver()
157 157
    {
158
    switch(mCurrSolver)
159
      {
160
      case 0 : mSolver = new Solver3x3Beginner(); break;
161
      case 1 : mSolver = new SolverKilominx(); break;
162
      default: android.util.Log.e("D", "unknown solver: "+mCurrSolver);
163
               mSolver = new Solver3x3Beginner(); break;
164
      }
158
    mSolver = PhasedSolverList.create(mCurrSolver);
165 159

  
166
    mObject = mSolver.getObject();
160
    if( mSolver!=null )
161
      {
162
      mObject = mSolver.getObject();
167 163

  
168
    int numPhases = mSolver.getNumPhases();
169
    String[] names = new String[numPhases];
170
    for(int p=0; p<numPhases; p++) names[p] = mSolver.getPhaseName(p);
164
      int numPhases = mSolver.getNumPhases();
165
      String[] names = new String[numPhases];
166
      for(int p=0; p<numPhases; p++) names[p] = mSolver.getPhaseName(p);
171 167

  
172
    return names;
168
      return names;
169
      }
170
    return new String[] {"NONE"};
173 171
    }
174 172

  
175 173
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff