Project

General

Profile

« Previous | Next » 

Revision eff371f4

Added by Leszek Koltunski about 3 years ago

Bandaged objects: first step making automatic scrambling work.

View differences:

src/main/java/org/distorted/objects/TwistyBandagedAbstract.java
371 371
    }
372 372

  
373 373
///////////////////////////////////////////////////////////////////////////////////////////////////
374
// TODO
375

  
376
  public int randomizeNewRotAxis(Random rnd, int oldRotAxis)
377
    {
378
    int numAxis = ROTATION_AXIS.length;
379

  
380
    if( oldRotAxis == START_AXIS )
381
      {
382
      return rnd.nextInt(numAxis);
383
      }
384
    else
385
      {
386
      int newVector = rnd.nextInt(numAxis-1);
387
      return (newVector>=oldRotAxis ? newVector+1 : newVector);
388
      }
389
    }
390

  
391
///////////////////////////////////////////////////////////////////////////////////////////////////
392
// TODO
393

  
394
  public int randomizeNewRow(Random rnd, int oldRotAxis, int oldRow, int newRotAxis)
395
    {
396
    float rowFloat = rnd.nextFloat();
397

  
398
    for(int row=0; row<mRowChances.length; row++)
399
      {
400
      if( rowFloat<=mRowChances[row] ) return row;
401
      }
402

  
403
    return 0;
404
    }
405

  
406
///////////////////////////////////////////////////////////////////////////////////////////////////
407
// TODO
408 374

  
409 375
  public boolean isSolved()
410 376
    {

Also available in: Unified diff