Project

General

Profile

« Previous | Next » 

Revision c60d98c4

Added by Leszek Koltunski about 2 years ago

Bugfix

View differences:

src/main/java/org/distorted/objectlib/scrambling/ObjectScrambler.java
420 420
      numMoves = currState.numMoves(indexExcluded);
421 421
      }
422 422

  
423
    int randMove = rnd.nextInt(numMoves);
424
    int moveIndex = currState.getNthMove(randMove,indexExcluded);
425
    mSignature = currState.getMove(moveIndex);
423
    if( numMoves==0 )
424
      {
425
      scramble[curr][0] = 0;
426
      scramble[curr][1] = 0;
427
      scramble[curr][2] = 0;
428
      }
429
    else
430
      {
431
      int randMove = rnd.nextInt(numMoves);
432
      int moveIndex = currState.getNthMove(randMove,indexExcluded);
433
      mSignature = currState.getMove(moveIndex);
426 434

  
427
    scramble[curr][0] = moveIndex/9;
428
    scramble[curr][1] = (moveIndex%9)/3;
435
      scramble[curr][0] = moveIndex/9;
436
      scramble[curr][1] = (moveIndex%9)/3;
429 437

  
430
    switch(moveIndex%3)
431
      {
432
      case 0: scramble[curr][2] = -1; break;
433
      case 1: scramble[curr][2] =  2; break;
434
      case 2: scramble[curr][2] =  1; break;
438
      switch(moveIndex%3)
439
        {
440
        case 0: scramble[curr][2] = -1; break;
441
        case 1: scramble[curr][2] =  2; break;
442
        case 2: scramble[curr][2] =  1; break;
443
        }
435 444
      }
436 445

  
437 446
    ScrambleStateBandaged3x3 nextState = new ScrambleStateBandaged3x3(mSignature);

Also available in: Unified diff