Project

General

Profile

« Previous | Next » 

Revision 5e254115

Added by Leszek Koltunski over 2 years ago

auto-compute the bandaged status from dimension of the CENTERS. Make 'computeBitmapFromRow' generic for bandageed and not bandaged objects.

View differences:

src/main/java/org/distorted/objects/TwistySquare1.java
275 275
    return mStickerType[variant][cubitface]*FACE_COLORS.length + mStickerColor[cubit][cubitface];
276 276
    }
277 277

  
278
///////////////////////////////////////////////////////////////////////////////////////////////////
279
// this implements the fact that corner cubits have multiple 'centers' and this means the cubit
280
// might span more than one layer along a given axis - i.e. that this is a bandaged puzzle.
281

  
282
  int computeBitmapFromRow(int rowBitmap, int axis)
283
    {
284
    int bitmap, initBitmap=0;
285

  
286
    while( initBitmap!=rowBitmap )
287
      {
288
      initBitmap = rowBitmap;
289

  
290
      for(int cubit=0; cubit<NUM_CUBITS; cubit++)
291
        {
292
        bitmap = CUBITS[cubit].mRotationRow[axis];
293
        if( (rowBitmap & bitmap) != 0 ) rowBitmap |= bitmap;
294
        }
295
      }
296

  
297
    return rowBitmap;
298
    }
299

  
300 278
///////////////////////////////////////////////////////////////////////////////////////////////////
301 279

  
302 280
  private boolean cornerIsUp(int index)

Also available in: Unified diff