Project

General

Profile

« Previous | Next » 

Revision df1b6296

Added by Leszek Koltunski over 3 years ago

Minx'es: fix for the automatic rotations.

View differences:

src/main/java/org/distorted/objects/TwistyMinx.java
446 446
  public void randomizeNewScramble(int[][] scramble, Random rnd, int num)
447 447
    {
448 448
    int numLayers = getNumLayers();
449
    int nom = (numLayers-1)/2;
450
    int row = rnd.nextInt(nom);
449 451

  
450 452
    if( num==0 )
451 453
      {
452
      scramble[num][0] = rnd.nextInt(NUM_AXIS);
453
      }
454
    else
455
      {
456
      int newVector = rnd.nextInt(NUM_AXIS -1);
457
      scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector);
458
      }
459

  
460
    if( num==0 )
461
      {
462
      int nom = (numLayers-1)/2;
463
      int row = rnd.nextInt(nom);
464 454
      int lf  = rnd.nextInt(2);
455
      scramble[num][0] = rnd.nextInt(NUM_AXIS);
465 456
      scramble[num][1] = (lf==0 ? row : numLayers-1-row);
466 457
      }
467 458
    else
468 459
      {
469
      int nom = (numLayers-1)/2;
470
      int row = rnd.nextInt(nom);
471 460
      boolean opposite = OPPOSITE_ROWS[scramble[num-1][0]][scramble[num][0]];
472 461
      boolean low = opposite^(scramble[num-1][1]<nom);
473
      scramble[num][1] = low ? row : numLayers-1-row;
462
      int newVector = rnd.nextInt(NUM_AXIS-1);
463
      scramble[num][0] = (newVector>=scramble[num-1][0] ? newVector+1 : newVector);
464
      scramble[num][1] = (low ? row : numLayers-1-row);
474 465
      }
475 466

  
476 467
    switch( rnd.nextInt(4) )

Also available in: Unified diff