Comparing version 0.0.2 to 0.0.3
@@ -6,2 +6,7 @@ #!/usr/bin/env node | ||
if (module.parent) { | ||
module.exports = boggle; | ||
return; | ||
} | ||
// top level input checks, but not too strict | ||
@@ -8,0 +13,0 @@ if (process.argv.length !== 3) { |
{ | ||
"name": "boggle", | ||
"version": "0.0.2", | ||
"version": "0.0.3", | ||
"description": "Boggle grid solver", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -13,3 +13,3 @@ # Boggle solver | ||
The spaces between letters are options, it could be single | ||
The spaces between letters are optional, it could be single | ||
string with 16 characters. In this case, you don't need quotes: | ||
@@ -19,3 +19,3 @@ | ||
Case does not matter, it will be converted to lowercase. | ||
Case does not matter, characters will be converted to lowercase. | ||
@@ -25,6 +25,6 @@ ## Main logic | ||
The algorithm iterates over the 2D grid, trying to walk | ||
depth first, while possible (including diagonally, but not | ||
visiting same cell more than once). At each step, the accumulated | ||
depth first, including diagonally, but not | ||
visiting same cell more than once. At each step, the accumulated | ||
string is checked against the dictionary. Walking stops and | ||
the algorithm backtracks to previous depth if the string | ||
the algorithm backtracks to previous depth level if the string | ||
is no longer a valid word or valid word prefix. | ||
@@ -75,2 +75,4 @@ | ||
* Use jshint to see possible bugs | ||
* Use jshint to see possible bugs | ||
* check dictionary initialization (is it a good idea to initialize using a sorted words array) | ||
* hook into trie implementation to store previous prefix query, because we keep asking for same prefix path "h - he - hel - hell - hello". |
@@ -64,2 +64,3 @@ var check = require('check-types'); | ||
function boggle(str) { | ||
// console.log('boggle on', str); | ||
if (check.isString(str)) { | ||
@@ -66,0 +67,0 @@ str = str.replace(/\s/g, ''); |
8791
178
74