summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-I
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-03-21 13:03:58 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-11-15 17:38:44 +0100
commit02d71d87de40ad3a14b67726683747b415fa9158 (patch)
tree064edbfe5df4b28a7a80f34b851446b6ee85e06e /Algorithms/Part-I
parent7afa77247fbe45fbd6c149da83ac6a91ff5731b9 (diff)
downloadcoursera-02d71d87de40ad3a14b67726683747b415fa9158.zip
coursera-02d71d87de40ad3a14b67726683747b415fa9158.tar.gz
Algorithms-I : 4-Puzzle: add with tests
Diffstat (limited to 'Algorithms/Part-I')
-rw-r--r--Algorithms/Part-I/4-Puzzle/puzzle02.txt11
-rw-r--r--Algorithms/Part-I/4-Puzzle/puzzle3x3-unsolvable2.txt4
-rw-r--r--Algorithms/Part-I/4-Puzzle/puzzle41.txt7
-rw-r--r--Algorithms/Part-I/4-Puzzle/puzzle4x4-hard2.txt6
-rwxr-xr-xAlgorithms/Part-I/4-Puzzle/run.sh22
5 files changed, 50 insertions, 0 deletions
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