summaryrefslogtreecommitdiffstats
path: root/Algorithms/Part-II/4-Boggle/BoggleSolver.java
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2013-12-28 03:14:04 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2013-12-28 03:14:04 +0100
commitb3874c6eb1e17c36d63c693f275f4d1d6ea8e8c1 (patch)
tree2df272538b0cdab3a118d5f0252742cd3bc5b85c /Algorithms/Part-II/4-Boggle/BoggleSolver.java
parent19f6dfdb9f3c38e9af245131f1b0e8cffd18467b (diff)
downloadcoursera-b3874c6eb1e17c36d63c693f275f4d1d6ea8e8c1.zip
coursera-b3874c6eb1e17c36d63c693f275f4d1d6ea8e8c1.tar.gz
Algorithms-II : 4-Boggle add prototypes and data
Diffstat (limited to 'Algorithms/Part-II/4-Boggle/BoggleSolver.java')
-rw-r--r--Algorithms/Part-II/4-Boggle/BoggleSolver.java37
1 files changed, 37 insertions, 0 deletions
diff --git a/Algorithms/Part-II/4-Boggle/BoggleSolver.java b/Algorithms/Part-II/4-Boggle/BoggleSolver.java
new file mode 100644
index 0000000..49633cd
--- /dev/null
+++ b/Algorithms/Part-II/4-Boggle/BoggleSolver.java
@@ -0,0 +1,37 @@
+/* vim: set expandtab tabstop=4 shiftwidth=4 : */
+
+public class BoggleSolver
+{
+ // assume each word in the dictionary contains only [A-Z]
+ public BoggleSolver(String[] dictionary)
+ {
+ }
+
+ // Returns the set of all valid words in the given Boggle board
+ public Iterable<String> getAllValidWords(BoggleBoard board)
+ {
+ return null;
+ }
+
+ // Returns the score if it is in the dictionary, zero otherwise.
+ // assume the word contains only [A-Z]
+ public int scoreOf(String word)
+ {
+ return -1;
+ }
+
+ public static void main(String[] args)
+ {
+ In in = new In(args[0]);
+ String[] dictionary = in.readAllStrings();
+ BoggleSolver solver = new BoggleSolver(dictionary);
+ BoggleBoard board = new BoggleBoard(args[1]);
+ int score = 0;
+ for (String word : solver.getAllValidWords(board))
+ {
+ StdOut.println(word);
+ score += solver.scoreOf(word);
+ }
+ StdOut.println("Score = " + score);
+ }
+}