Revision 5312255f
Added by Leszek Koltunski almost 2 years ago
src/main/java/org/distorted/solvers/SolverCube2.java | ||
---|---|---|
17 | 17 |
import org.distorted.objectlib.tablebases.ImplementedTablebasesList; |
18 | 18 |
import org.distorted.objectlib.tablebases.TablebaseHelpers; |
19 | 19 |
import org.distorted.objectlib.tablebases.TablebasesAbstract; |
20 |
import org.distorted.objectlib.tablebases.TablebasesCube2; |
|
20 | 21 |
|
21 | 22 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
22 | 23 |
|
... | ... | |
186 | 187 |
int result0 = computeFaceColors(corners); |
187 | 188 |
if( result0<0 ) return result0; |
188 | 189 |
|
189 |
int[] corner_perm = new int[8];
|
|
190 |
int result1 = retCornerPermutation(corner_perm,corners);
|
|
190 |
int[] perm = new int[8]; |
|
191 |
int result1 = retCornerPermutation(perm,corners); |
|
191 | 192 |
if( result1<0 ) return result1; |
192 | 193 |
|
193 |
int[] perm = new int[7]; |
|
194 |
|
|
195 |
perm[0] = corner_perm[0]>1 ? corner_perm[0]-1 : corner_perm[0]; |
|
196 |
perm[1] = corner_perm[2]>1 ? corner_perm[2]-1 : corner_perm[2]; |
|
197 |
perm[2] = corner_perm[3]>1 ? corner_perm[3]-1 : corner_perm[3]; |
|
198 |
perm[3] = corner_perm[4]>1 ? corner_perm[4]-1 : corner_perm[4]; |
|
199 |
perm[4] = corner_perm[5]>1 ? corner_perm[5]-1 : corner_perm[5]; |
|
200 |
perm[5] = corner_perm[6]>1 ? corner_perm[6]-1 : corner_perm[6]; |
|
201 |
perm[6] = corner_perm[7]>1 ? corner_perm[7]-1 : corner_perm[7]; |
|
202 |
|
|
203 |
int perm_num = TablebaseHelpers.computePermutationNum(perm); |
|
194 |
int[] perm7 = TablebasesCube2.shrinkPerm(perm); |
|
195 |
int permNum = TablebaseHelpers.computePermutationNum(perm7); |
|
204 | 196 |
int[] twist = new int[8]; |
205 |
fillCornerTwists(twist,corners,corner_perm);
|
|
197 |
fillCornerTwists(twist,corners,perm); |
|
206 | 198 |
|
207 | 199 |
int totalTwist = 0; |
208 | 200 |
for(int i=0; i<8; i++) totalTwist += twist[i]; |
... | ... | |
210 | 202 |
|
211 | 203 |
int twistNum = twist[0] + 3*(twist[2] + 3*(twist[3] + 3*(twist[4] + 3*(twist[5] + 3*twist[6])))); |
212 | 204 |
|
213 |
return twistNum + 729*perm_num;
|
|
205 |
return twistNum + 729*permNum;
|
|
214 | 206 |
} |
215 | 207 |
|
216 | 208 |
/////////////////////////////////////////////////////////////////////////////////////////////////// |
... | ... | |
289 | 281 |
{ |
290 | 282 |
if( mSolver==null ) |
291 | 283 |
{ |
292 |
mSolver = ImplementedTablebasesList.createUnpacked(ObjectSignatures.CUBE_2); |
|
293 |
// if( mSolver!=null ) mSolver.createTablebase(); |
|
284 |
mSolver = ImplementedTablebasesList.createPacked(res,ObjectSignatures.CUBE_2); |
|
294 | 285 |
} |
295 | 286 |
|
296 | 287 |
return mSolver!=null ? mSolver.solution(index,null) : null; |
Also available in: Unified diff
Cube2 tablebases solver finished.