Project

General

Profile

« Previous | Next » 

Revision 8b5618fa

Added by Leszek Koltunski about 1 year ago

one fix for the attempt to cover all objects under one 'isSolved2' method.

View differences:

src/main/java/org/distorted/objectlib/main/TwistyObjectSolved.java
40 40
  private int[][] mCubitFaceToSurfaceMap;
41 41
  private int[][] mCubitFaceToPuzzleFaceMap;
42 42
  private int[] mPuzzleFaceColor;
43
  private int mNumInitialSurfaces;
43 44

  
44 45
///////////////////////////////////////////////////////////////////////////////////////////////////
45 46
// METHOD 0
......
433 434

  
434 435
          android.util.Log.e("D", "added surface "+tmpSurfaces.size()+" cubit "+c+" face "+f+" variant "+variant);
435 436
          android.util.Log.e("D", si.print() );
437
          }
438
        }
439
      }
436 440

  
437
          int[] indices = new int[mNumQuats];
441
    mNumInitialSurfaces = tmpSurfaces.size();
442
    mTmpFaceColorTable = new int[mNumInitialSurfaces][2];
438 443

  
439
          for(int q=0; q<mNumQuats; q++)
440
            {
441
            TwistyObjectSurface ts = si.rotateSurface(mObjectQuats[q]);
442
            int ind = adjoinNewSurface(tmpSurfaces,ts);
443
            indices[q] = ind;
444
            }
444
    for(int s=0; s<mNumInitialSurfaces; s++)
445
      {
446
      TwistyObjectSurface si = tmpSurfaces.get(s);
445 447

  
446
          si.setIndices(indices);
447
          }
448
      int[] indices = new int[mNumQuats];
449

  
450
      for(int q=0; q<mNumQuats; q++)
451
        {
452
        TwistyObjectSurface ts = si.rotateSurface(mObjectQuats[q]);
453
        int ind = adjoinNewSurface(tmpSurfaces,ts);
454
        indices[q] = ind;
448 455
        }
456

  
457
      si.setIndices(indices);
449 458
      }
450 459

  
451 460
    int size = tmpSurfaces.size();
......
516 525
  private boolean isSolved2(TwistyObjectCubit[] cubits)
517 526
    {
518 527
    int filled = 0;
519
    int max = mTmpFaceColorTable.length;
520 528

  
521
    android.util.Log.e("D","isSolved2");
529
    android.util.Log.e("D","isSolved2 numInitialSurfaces="+mNumInitialSurfaces);
522 530

  
523 531
    for(int c=0; c<mNumCubits; c++)
524 532
      {
......
543 551

  
544 552
          if( prevColor==0 )
545 553
            {
546
            if( filled>=max )
554
            if( filled>=mNumInitialSurfaces )
547 555
              {
548
              android.util.Log.e("D", "cubit "+c+" face "+f+" filled: "+filled+" max: "+max+" return false");
556
              android.util.Log.e("D", "cubit "+c+" face "+f+" filled: "+filled+" max: "+mNumInitialSurfaces+" return false");
549 557
              return false;
550 558
              }
551 559

  
......
582 590
    mFunctionIndex = index;
583 591
    mTmpQuats = new int[mNumQuats];
584 592

  
585
    if( mFunctionIndex==2 )
586
      {
587
      computeSurfaceTable();
588
      int numFaces = parent.getNumPuzzleFaces();
589
      mTmpFaceColorTable = new int[numFaces][2];
590
      }
593
    if( mFunctionIndex==2 ) computeSurfaceTable();
591 594
    }
592 595

  
593 596
///////////////////////////////////////////////////////////////////////////////////////////////////

Also available in: Unified diff