Project

General

Profile

« Previous | Next » 

Revision 2ee27c13

Added by Leszek Koltunski over 1 year ago

Dino4 solver: progress.

View differences:

src/main/java/org/distorted/solvers/SolverDino4.java
9 9

  
10 10
package org.distorted.solvers;
11 11

  
12
import static org.distorted.objectlib.main.TwistyObject.*;
13

  
12 14
import android.content.res.Resources;
13 15

  
14 16
import org.distorted.main.R;
15 17
import org.distorted.objectlib.main.ObjectSignatures;
16 18
import org.distorted.objectlib.main.TwistyObject;
19
import org.distorted.objectlib.shape.ShapeHexahedron;
17 20
import org.distorted.objectlib.tablebases.ImplementedTablebasesList;
18 21
import org.distorted.objectlib.tablebases.TBDino4;
19 22
import org.distorted.objectlib.tablebases.TablebasesAbstract;
......
48 51

  
49 52
  private int checkEdges(int[][] edges)
50 53
    {
51
    int numBlue=0,numRed=0, numYellow=0, numWhite=0;
54
    int numB=0,numR=0, numY=0, numW=0;
55
    int indB=0,indY=0, indW=0, indR=0;
56

  
57
    int[] hexColors = ShapeHexahedron.FACE_COLORS;
58

  
59
    for(int i=0; i<6; i++)
60
      {
61
      int color = hexColors[i];
62

  
63
      if( color==COLOR_WHITE  ) indW = i;
64
      if( color==COLOR_YELLOW ) indY = i;
65
      if( color==COLOR_RED    ) indR = i;
66
      if( color==COLOR_BLUE   ) indB = i;
67
      }
52 68

  
53 69
    for(int i=0; i<12; i++)
54 70
      {
55 71
      int e = edges[0][i];
56 72

  
57 73
      if( e==edges[1][i] )
58
        switch(e)
59
          {
60
          case 0: numYellow++; break;
61
          case 1: numWhite++ ; break;
62
          case 2: numBlue++  ; break;
63
          case 3: numRed++   ; break;
64
          }
74
        {
75
        if( e==indY ) numY++;
76
        if( e==indW ) numW++;
77
        if( e==indR ) numR++;
78
        if( e==indB ) numB++;
79
        }
65 80
      }
66 81

  
67
    if( numYellow!=3 ) { mErrorColor=0; return ERROR_EDGE_THREE; }
68
    if( numWhite !=3 ) { mErrorColor=1; return ERROR_EDGE_THREE; }
69
    if( numBlue  !=3 ) { mErrorColor=2; return ERROR_EDGE_THREE; }
70
    if( numRed   !=3 ) { mErrorColor=3; return ERROR_EDGE_THREE; }
82
    if( numY !=3 ) { mErrorColor=0; return ERROR_EDGE_THREE; }
83
    if( numW !=3 ) { mErrorColor=1; return ERROR_EDGE_THREE; }
84
    if( numB !=3 ) { mErrorColor=2; return ERROR_EDGE_THREE; }
85
    if( numR !=3 ) { mErrorColor=3; return ERROR_EDGE_THREE; }
71 86

  
72 87
    return 0;
73 88
    }

Also available in: Unified diff