commit 29dd01c64fba2275cc7f3aacd3b3f6e46801cc49
Author: Leszek Koltunski <leszek@distorted.org>
Date:   Wed Aug 3 00:48:35 2016 +0100

    Further simplify and speed up the DistortedCubes target.

diff --git a/src/main/java/org/distorted/library/DistortedCubesGrid.java b/src/main/java/org/distorted/library/DistortedCubesGrid.java
index 2c90023..4fe68bc 100644
--- a/src/main/java/org/distorted/library/DistortedCubesGrid.java
+++ b/src/main/java/org/distorted/library/DistortedCubesGrid.java
@@ -76,7 +76,7 @@ class DistortedCubesGrid extends DistortedObjectGrid
 
    private boolean isNE(int row,int col)
      {
-     return ( (row<=(mRows-1)/2)^(col<=(mCols-1)/2) );
+     return ( (2*row<mRows)^(2*col<mCols) );
      }
 
 ///////////////////////////////////////////////////////////////////////////////////////////////////
@@ -93,15 +93,15 @@ class DistortedCubesGrid extends DistortedObjectGrid
       boolean thisBlockIsNE;        // the block we are currently looking at is split into
                                     // two triangles along the NE-SW line (rather than NW-SE)
 
-      for(int i=0; i<mRows; i++)
+      for(int row=0; row<mRows; row++)
          {
-         if( mCols>=2 && (mCubes[i][shiftCol]%2 == 1) && (mCubes[i][shiftCol+1]%2 == 1) ) triangleShifts++;
+         if( mCols>=2 && (mCubes[row][shiftCol]%2 == 1) && (mCubes[row][shiftCol+1]%2 == 1) ) triangleShifts++;
 
-         for(int j=0; j<mCols; j++)
+         for(int col=0; col<mCols; col++)
             {
-            if( mCubes[i][j]%2 == 1 )  // land
+            if( mCubes[row][col]%2 == 1 )  // land
               {
-              thisBlockIsNE = isNE(i,j);
+              thisBlockIsNE = isNE(row,col);
               if( thisBlockIsNE^lastBlockIsNE ) windingShifts++;
               lastBlockIsNE = thisBlockIsNE;
 /*
@@ -112,13 +112,13 @@ class DistortedCubesGrid extends DistortedObjectGrid
                 }
 */
               frontWalls++;
-              if( j==mCols-1 || mCubes[i][j+1]%2 == 0 ) frontSegments++;
+              if( col==mCols-1 || mCubes[row][col+1]%2 == 0 ) frontSegments++;
               }
               
-            if( (i==0 && mCubes[i][j]!=2) || (i!=0 && mCubes[i][j] != mCubes[i-1][j  ]) ) sideWalls++; // up
-            if( (j==0 && mCubes[i][j]!=2) || (j!=0 && mCubes[i][j] != mCubes[i  ][j-1]) ) sideWalls++; // left
-            if( i==mRows-1 && mCubes[i][j]!=2                                           ) sideWalls++; // bottom
-            if( j==mCols-1 && mCubes[i][j]!=2                                           ) sideWalls++; // right
+            if( (row==0 && mCubes[row][col]!=2) || (row!=0 && mCubes[row][col] != mCubes[row-1][col  ]) ) sideWalls++; // up
+            if( (col==0 && mCubes[row][col]!=2) || (col!=0 && mCubes[row][col] != mCubes[row  ][col-1]) ) sideWalls++; // left
+            if( row==mRows-1 && mCubes[row][col]!=2                                                     ) sideWalls++; // bottom
+            if( col==mCols-1 && mCubes[row][col]!=2                                                     ) sideWalls++; // right
             }
          }
 
