-
Notifications
You must be signed in to change notification settings - Fork 1
/
PuzzleGamePlay.java
17 lines (15 loc) · 2.59 KB
/
PuzzleGamePlay.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
import java.io.FileNotFoundException;
public class PuzzleGamePlay {
public static void main(String args[]) throws CloneNotSupportedException, FileNotFoundException {
String pieces1 = "0,[7, 2, 5, 7]; 1,[7, 18, 6, 2]; 2,[6, 3, 2, 10]; 3,[7, 9, 0, 16]; 4,[5, 12, 17, 20]; 5,[1, 5, 2, 4]; 6,[6, 4, 2, 2]; 7,[10, 20, 20, 10]; 8,[13, 12, 4, 19]; 9,[15, 19, 5, 18]; 10,[11, 11, 20, 5]; 11,[10, 14, 5, 11]; 12,[6, 5, 16, 8]; 13,[18, 16, 11, 4]; 14,[3, 20, 12, 3]; 15,[0, 3, 12, 16]; 16,[12, 20, 3, 9]; 17,[5, 18, 20, 17]; 18,[11, 9, 0, 7]; 19,[10, 7, 0, 13]; 20,[0, 16, 2, 12]; 21,[0, 19, 13, 0]; 22,[15, 3, 18, 16]; 23,[18, 19, 2, 6]; 24,[8, 0, 14, 20]; 25,[8, 20, 9, 15]; 26,[17, 1, 19, 3]; 27,[14, 2, 5, 12]; 28,[0, 20, 18, 16]; 29,[14, 0, 17, 14]; 30,[2, 16, 15, 8]; 31,[8, 1, 15, 12]; 32,[6, 18, 18, 1]; 33,[0, 9, 16, 18]; 34,[18, 12, 6, 4]; 35,[15, 6, 17, 18]; 36,[13, 17, 2, 10]; 37,[12, 8, 17, 0]; 38,[4, 13, 0, 16]; 39,[4, 6, 10, 1]; 40,[2, 14, 15, 0]; 41,[19, 12, 7, 11]; 42,[17, 19, 18, 0]; 43,[13, 0, 3, 4]; 44,[13, 0, 15, 1]; 45,[2, 3, 10, 3]; 46,[0, 9, 5, 9]; 47,[11, 10, 5, 16]; 48,[0, 9, 10, 9]; 49,[1, 9, 7, 18]; 50,[14, 9, 20, 2]; 51,[6, 5, 2, 11]; 52,[18, 11, 14, 19]; 53,[1, 4, 1, 16]; 54,[18, 9, 0, 0]; 55,[8, 20, 9, 7]; 56,[18, 5, 5, 5]; 57,[20, 3, 16, 2]; 58,[4, 7, 3, 18]; 59,[17, 20, 2, 17]; 60,[0, 9, 7, 12]; 61,[20, 14, 12, 0]; 62,[15, 15, 4, 8]; 63,[16, 4, 14, 6]; 64,[14, 12, 16, 0]; 65,[18, 6, 20, 7]; 66,[7, 8, 19, 10]; 67,[10, 6, 1, 10]; 68,[2, 0, 0, 15]; 69,[2, 11, 8, 4]; 70,[19, 15, 3, 3]; 71,[4, 4, 18, 15]; 72,[13, 19, 9, 0]; 73,[9, 16, 0, 12]; 74,[2, 8, 11, 2]; 75,[3, 0, 13, 7]; 76,[2, 12, 5, 17]; 77,[9, 13, 13, 13]; 78,[15, 0, 18, 5]; 79,[8, 20, 0, 9]; 80,[19, 0, 13, 2]; 81,[16, 7, 18, 0]; 82,[14, 0, 9, 7]; 83,[15, 17, 11, 17]; 84,[14, 5, 2, 5]; 85,[0, 8, 4, 3]; 86,[9, 3, 14, 0]; 87,[7, 3, 8, 13]; 88,[15, 4, 5, 10]; 89,[7, 4, 18, 16]; 90,[1, 2, 16, 6]; 91,[15, 12, 3, 12]; 92,[4, 3, 5, 17]; 93,[2, 7, 4, 1]; 94,[7, 20, 0, 18]; 95,[12, 17, 16, 9]; 96,[4, 7, 14, 7]; 97,[9, 0, 12, 13]; 98,[0, 14, 17, 0]; 99,[15, 4, 5, 13]";
String pieces2 = "0,[0, 0, 2, 1]; 1,[2, 0, 0, 3]; 2,[3, 0, 0, 4]; 3,[1, 4, 0, 0];";
String pieces3 = "0,[0, 0, 2, 1]; 1,[2, 0, 3, 10]; 2,[3, 0, 0, 4]; 3,[4, 0, 5, 11]; 4,[5, 0, 0, 11]; 5,[11, 0, 7, 12]; 6,[7, 0, 0, 8]; 7,[8, 0, 1, 9]; 8,[9, 10, 11, 12];";
// Make a new Puzzle from a String of Pieces
Puzzle puzzle = new Puzzle(pieces1);
// Solve the Puzzle and print the solutions to console
puzzle.solve();
if (puzzle.getNumOfSolutions() == 0) {
System.out.println("The Puzzle is not valid.\nThere are no available solutions for the Puzzle.");
}
}
}