Revision c389d4ba
Added by Leszek Koltunski 8 months ago
src/main/java/org/distorted/objectlib/solvers/verifiers/SolverKociembaCUBE3.java | ||
---|---|---|
163 | 163 |
*/ |
164 | 164 |
public void solve(ResultScreen screen, int[] quats) |
165 | 165 |
{ |
166 |
SolverSearch.prepare(mOS);
|
|
167 |
String objectPosition = preparePosition();
|
|
168 |
String result = SolverSearch.solution(objectPosition, 24, 20);
|
|
166 |
int q0 = quats[0];
|
|
167 |
int len = quats.length;
|
|
168 |
boolean theSame = true;
|
|
169 | 169 |
|
170 |
// this should be impossible since we've validated the position already! |
|
171 |
if( result.contains("Error") ) screen.displayImpossibleDialog(result); |
|
172 |
else screen.setSolved(result); |
|
170 |
for(int q=1; q<len; q++) |
|
171 |
if( quats[q]!=q0 ) |
|
172 |
{ |
|
173 |
theSame = false; |
|
174 |
break; |
|
175 |
} |
|
176 |
|
|
177 |
// original Kociemba solver returns 13-move long 'solution' to an already solved position! |
|
178 |
if( theSame ) |
|
179 |
{ |
|
180 |
screen.setSolved(null,0,null); |
|
181 |
} |
|
182 |
else |
|
183 |
{ |
|
184 |
SolverSearch.prepare(mOS); |
|
185 |
String objectPosition = preparePosition(); |
|
186 |
String result = SolverSearch.solution(objectPosition, 24, 20); |
|
187 |
|
|
188 |
// this should be impossible since we've validated the position already! |
|
189 |
if( result.contains("Error") ) screen.displayImpossibleDialog(result); |
|
190 |
else screen.setSolved(result); |
|
191 |
} |
|
173 | 192 |
} |
174 | 193 |
} |
175 | 194 |
|
Also available in: Unified diff
Do not call the Kociemba solver on an already solved position.