From 02d71d87de40ad3a14b67726683747b415fa9158 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 21 Mar 2013 13:03:58 +0100 Subject: Algorithms-I : 4-Puzzle: add with tests --- Algorithms/Part-I/4-Puzzle/puzzle02.txt | 11 +++++++++++ .../Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt | 4 ++++ Algorithms/Part-I/4-Puzzle/puzzle41.txt | 7 +++++++ Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt | 6 ++++++ Algorithms/Part-I/4-Puzzle/run.sh | 22 ++++++++++++++++++++++ 5 files changed, 50 insertions(+) create mode 100644 Algorithms/Part-I/4-Puzzle/puzzle02.txt create mode 100644 Algorithms/Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt create mode 100644 Algorithms/Part-I/4-Puzzle/puzzle41.txt create mode 100644 Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt create mode 100755 Algorithms/Part-I/4-Puzzle/run.sh diff --git a/Algorithms/Part-I/4-Puzzle/puzzle02.txt b/Algorithms/Part-I/4-Puzzle/puzzle02.txt new file mode 100644 index 0000000..35b261b --- /dev/null +++ b/Algorithms/Part-I/4-Puzzle/puzzle02.txt @@ -0,0 +1,11 @@ +9 + 1 2 3 4 5 6 7 8 9 +10 11 12 13 14 15 16 17 18 +19 20 21 22 23 24 25 26 27 +28 29 30 31 32 33 34 35 36 +37 38 39 40 41 42 43 44 45 +46 47 48 49 50 51 52 53 54 +55 56 57 58 59 60 61 62 63 +64 65 66 67 68 69 70 0 71 +73 74 75 76 77 78 79 80 72 + diff --git a/Algorithms/Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt b/Algorithms/Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt new file mode 100644 index 0000000..62b19b4 --- /dev/null +++ b/Algorithms/Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt @@ -0,0 +1,4 @@ +3 + 8 6 7 + 2 5 4 + 1 3 0 diff --git a/Algorithms/Part-I/4-Puzzle/puzzle41.txt b/Algorithms/Part-I/4-Puzzle/puzzle41.txt new file mode 100644 index 0000000..80e29a0 --- /dev/null +++ b/Algorithms/Part-I/4-Puzzle/puzzle41.txt @@ -0,0 +1,7 @@ +5 + 3 8 2 4 5 + 1 6 0 9 14 +19 7 12 10 13 +11 21 22 23 15 +17 16 18 24 20 + diff --git a/Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt b/Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt new file mode 100644 index 0000000..ec29a29 --- /dev/null +++ b/Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt @@ -0,0 +1,6 @@ +4 + 6 8 11 4 + 9 15 14 3 + 1 13 12 10 + 0 5 7 2 + diff --git a/Algorithms/Part-I/4-Puzzle/run.sh b/Algorithms/Part-I/4-Puzzle/run.sh new file mode 100755 index 0000000..c649493 --- /dev/null +++ b/Algorithms/Part-I/4-Puzzle/run.sh @@ -0,0 +1,22 @@ +#! /bin/bash + +export "CLASSPATH=$CLASSPATH:.:$HOME/algs4/algs4.jar:$HOME/algs4/stdlib.jar" + +CLASSES="Board Solver" + +rm *.class *.zip 2>/dev/null + +for kls in $CLASSES; do + ~/algs4/bin/checkstyle ${kls}.java + javac ${kls}.java +done +~/algs4/bin/findbugs *.class + +echo "RUN..." + +java Solver puzzle02.txt +java Solver puzzle3x3-unsolvable2.txt +java Solver puzzle41.txt +java Solver puzzle4x4-hard2.txt + +zip 8puzzle.zip Board.java Solver.java -- cgit v1.1-2-g2b99