Revision 16832029
Added by Leszek Koltunski 9 months ago
src/main/java/org/distorted/objectlib/tablebases/TBDino6.java | ||
---|---|---|
19 | 19 |
private static final int SOLVED1 = 0; |
20 | 20 |
private static final int SOLVED2 = 17977621; // quats (0,10,0,10, 11,11,11,11, 0,10,0,10) |
21 | 21 |
|
22 |
private OperatingSystemInterface mOS; |
|
23 |
|
|
22 | 24 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
23 | 25 |
|
24 | 26 |
public TBDino6() |
... | ... | |
31 | 33 |
public TBDino6(OperatingSystemInterface os) |
32 | 34 |
{ |
33 | 35 |
super(os,new int[] {R.raw.dino_3_pruning3,R.raw.dino_3_pruning4},new int[] {R.raw.dino_3_pruning10}); |
36 |
|
|
37 |
mOS = os; |
|
34 | 38 |
} |
35 | 39 |
|
36 | 40 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
93 | 97 |
public static int getIndexFromPerm(int[] perm) |
94 | 98 |
{ |
95 | 99 |
int[] perm11 = new int[11]; |
96 |
for(int i=0; i<11; i++) perm11[i] = perm[i+1]-1; |
|
100 |
|
|
101 |
for(int i=0; i<11; i++) |
|
102 |
{ |
|
103 |
if( perm[i+1]<=0 ) return -1; |
|
104 |
perm11[i] = perm[i+1]-1; |
|
105 |
} |
|
106 |
|
|
97 | 107 |
return TablebaseHelpers.computeEvenPermutationNum(perm11); |
98 | 108 |
} |
99 | 109 |
|
... | ... | |
114 | 124 |
{ |
115 | 125 |
normalizeQuats(quats); |
116 | 126 |
int[] perm = getPermFromQuats(quats); |
117 |
return getIndexFromPerm(perm); |
|
127 |
int ret = getIndexFromPerm(perm); |
|
128 |
|
|
129 |
if( ret<0 ) |
|
130 |
{ |
|
131 |
if( mOS!=null ) |
|
132 |
{ |
|
133 |
StringBuilder sb = new StringBuilder(); |
|
134 |
|
|
135 |
for(int i=0; i<12; i++) |
|
136 |
{ |
|
137 |
sb.append(quats[i]); |
|
138 |
sb.append(' '); |
|
139 |
} |
|
140 |
|
|
141 |
mOS.reportError("TBDino6 getIndex: "+sb); |
|
142 |
} |
|
143 |
return 0; |
|
144 |
} |
|
145 |
|
|
146 |
return ret; |
|
118 | 147 |
} |
119 | 148 |
} |
120 | 149 |
|
Also available in: Unified diff
Debugs for the crash in Dino6 solver