15 puzzle solver: Difference between revisions

m
m (Small code improvement.)
m (→‎{{header|Wren}}: Minor tidy)
 
(One intermediate revision by one other user not shown)
Line 6,376:
private static class Puzzle {
 
public Puzzle(List<Integer> aTiles, List<String> aMoves, int aZeroIndex, longint aSearchDepth) {
tiles = aTiles;
moves = aMoves;
Line 6,421:
System.out.println();
}
 
@Override
public int hashCode() {
int hash = 3;
hash = 23 * hash + tiles.hashCode();
hash = 23 * hash + zeroIndex;
return hash;
}
 
@Override
Line 6,436 ⟶ 6,428:
case Object object -> false;
};
}
@Override
public int hashCode() {
int hash = 3;
hash = 23 * hash + tiles.hashCode();
hash = 23 * hash + zeroIndex;
return hash;
}
Line 6,441:
private List<String> moves;
private int zeroIndex;
private longint searchDepth;
private static final List<Integer> GOAL = List.of( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 );
Line 10,562:
{{libheader|Wren-long}}
This works but is very slow (132 seconds).
<syntaxhighlight lang="ecmascriptwren">import "./long" for ULong
 
var Nr = [3, 0, 0, 0, 0, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3]
9,477

edits