Project

General

Profile

« Previous | Next » 

Revision 7f84a768

Added by Leszek Koltunski about 4 years ago

Progress with the 3x3x3 Solver.

Hopefully the only thing that remains to be done is to implement the RubikStateSolver.retCubeString().

View differences:

src/main/java/org/distorted/states/RubikStateSolver.java
134 134

  
135 135
  void leaveState(RubikActivity act)
136 136
    {
137
    RubikPostRender post = act.getPostRender();
138
    post.resetAllTextureMaps();
137

  
139 138
    }
140 139

  
141 140
///////////////////////////////////////////////////////////////////////////////////////////////////
......
177 176
    }
178 177

  
179 178
///////////////////////////////////////////////////////////////////////////////////////////////////
180
// TODO
181 179

  
182
  private void setSolved( RubikActivity act, int numMoves, String moves)
180
  private void setSolved( final RubikActivity act, final int numMoves, final String moves)
183 181
    {
184
    RubikState.switchState(act,RubikState.SOLU);
182
    act.runOnUiThread(new Runnable()
183
      {
184
      @Override
185
      public void run()
186
        {
187
        RubikState.switchState(act,RubikState.SOLU);
188
        RubikStateSolution solution = (RubikStateSolution) RubikState.SOLU.getStateClass();
189
        solution.setupMoves(act, numMoves, moves);
190
        }
191
      });
185 192
    }
186 193

  
187 194
///////////////////////////////////////////////////////////////////////////////////////////////////
......
261 268
        {
262 269
        if( !mSolving )
263 270
          {
264
          String cubeString = "INVALID"; // TODO: obtain a valid cube string
271
          String cubeString = retCubeString();
265 272
          Solver solver = new Solver(cubeString, act );
266 273
          solver.start();
267 274
          mSolving = true;
......
286 293
      @Override
287 294
      public void onClick(View v)
288 295
        {
296
        RubikPostRender post = act.getPostRender();
297
        post.resetAllTextureMaps();
289 298
        RubikState.goBack(act);
290 299
        }
291 300
      });
......
310 319
      }
311 320
    }
312 321

  
322
///////////////////////////////////////////////////////////////////////////////////////////////////
323
// TODO
324

  
325
	private String retCubeString()
326
    {
327
		String ret="UUUUUUUUURRRRRRRRRFFFFFFFFFDDDDDDDDDLLLLLLLLLBBBBBBBBB";
328
/*
329
		int color;
330
		int F=retColor(FRONT , 1,1);
331
		int B=retColor(BACK  , 1,1);
332
		int L=retColor(LEFT  , 1,1);
333
		int R=retColor(RIGHT , 1,1);
334
		int U=retColor(TOP   , 1,1);
335
		int D=retColor(BOTTOM, 1,1);
336

  
337
		for(int face in {TOP,RIGHT,FRONT,BOTTOM,LEFT,BACK} )
338
		  for(int row=0; row<mSize; row++)
339
			  for(int col=0; col<mSize; col++)
340
			    {
341
				  color = retColor(TOP,col,row);
342

  
343
				  if(color==F) ret+="F";
344
				  if(color==B) ret+="B";
345
				  if(color==L) ret+="L";
346
				  if(color==R) ret+="R";
347
				  if(color==U) ret+="U";
348
				  if(color==D) ret+="D";
349
			    }
350
*/
351
		return ret;
352
	  }
353

  
313 354
///////////////////////////////////////////////////////////////////////////////////////////////////
314 355

  
315 356
  public void savePreferences(SharedPreferences.Editor editor)

Also available in: Unified diff