Project

General

Profile

« Previous | Next » 

Revision 906cc928

Added by Leszek Koltunski about 4 years ago

Change the format of moves in Pretty Patterns to more terse, so that patterns of objects with 4 axis of rotation ( Pyraminx!) fit into 3 digits.

View differences:

src/main/java/org/distorted/patterns/RubikPattern.java
394 394

  
395 395
  public static void parseMoves(int[][] result, int numMoves, String moves)
396 396
    {
397
    int digit0, digit1, digit2;
397
    int digit0, digit1, digit2, number;
398 398

  
399 399
    for(int i=0; i<numMoves; i++)
400 400
      {
401 401
      digit0 = moves.charAt(4*i+1)-'0';
402 402
      digit1 = moves.charAt(4*i+2)-'0';
403 403
      digit2 = moves.charAt(4*i+3)-'0';
404
      number = 100*digit0+10*digit1+digit2;
404 405

  
405
      result[i][0] = (10*digit0+digit1)/32;
406
      result[i][1] = (10*digit0+digit1)%32;
407
      result[i][2] = 2-digit2;
406
      result[i][0] =  (number/32)%4;
407
      result[i][1] =  (number%32)  ;
408
      result[i][2] =2-(number/32)/4;
408 409
      }
409 410
    }
410 411

  

Also available in: Unified diff