15 puzzle solver: Difference between revisions
Content added Content deleted
m (Small code improvement.) |
m (Small coding improvements.) |
||
Line 6,376: | Line 6,376: | ||
private static class Puzzle { |
private static class Puzzle { |
||
public Puzzle(List<Integer> aTiles, List<String> aMoves, int aZeroIndex, |
public Puzzle(List<Integer> aTiles, List<String> aMoves, int aZeroIndex, int aSearchDepth) { |
||
tiles = aTiles; |
tiles = aTiles; |
||
moves = aMoves; |
moves = aMoves; |
||
Line 6,421: | Line 6,421: | ||
System.out.println(); |
System.out.println(); |
||
} |
} |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
@Override |
@Override |
||
Line 6,436: | Line 6,428: | ||
case Object object -> false; |
case Object object -> false; |
||
}; |
}; |
||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
⚫ | |||
} |
} |
||
Line 6,441: | Line 6,441: | ||
private List<String> moves; |
private List<String> moves; |
||
private int zeroIndex; |
private int zeroIndex; |
||
private |
private int 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 ); |
private static final List<Integer> GOAL = List.of( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 0 ); |