Project

General

Profile

« Previous | Next » 

Revision 5cf34c5f

Added by Leszek Koltunski about 4 years ago

Make chances to randimoze a given row when scrambling dependant on the type of Object.

The point: in case of the Cube, all rows should have equal chances. In case of the Pyraminx, the smaller the row, the smaller the chance should be. In particular the trivial 4 corners of the tetraherdon should have a very small chance to be selected.

View differences:

src/main/java/org/distorted/objects/RubikPyraminx.java
310 310
    return getSize()/(SQ3/2);
311 311
    }
312 312

  
313
///////////////////////////////////////////////////////////////////////////////////////////////////
314

  
315
  public float[] getRowChances()
316
    {
317
    int size = getSize();
318
    int total = size*(size+1)/2;
319
    float running=0.0f;
320
    float[] chances = new float[size];
321

  
322
    for(int i=0; i<size; i++)
323
      {
324
      running += (size-i);
325
      chances[i] = running / total;
326
      }
327

  
328
    return chances;
329
    }
330

  
313 331
///////////////////////////////////////////////////////////////////////////////////////////////////
314 332

  
315 333
  public float returnRotationFactor(float offset)

Also available in: Unified diff