Browse files

removed condition, updated readme with instructions

  • Loading branch information...
1 parent 0d2995a commit 1deb2163b23ba3875c68fa92674b64cb270ace47 @benjaminplee committed Jun 7, 2012
Showing with 21 additions and 15 deletions.
  1. +20 −14
  2. +1 −1 src/word.erl
@@ -1,24 +1,30 @@
-basic idea:
-Gen-Event-Manager (for words that exist)
-Gen-Events for each valid word in dictionary as state
- if incoming event matches state
- spawn new process to handle word
+implementation creates process for each word in dictionary, sends lookup
+to start word and each process sends out messages to others as
+candidates in the chain/ladder, not knowing if it is a word or not
-initialize: add all words from file as event handlers
+hacked together a a discussion piece and not as an example of fine code.
+only supports 4 letter words
-Find-Ladder call to look
- trigger event for start word with it as history as nothing
+currently, to run
-Link module
- if word = goal word, print
- otherwise
- needs to spawn event for switching every letter in the word
- with all other characters possible (ascii #)
+# from shell, will get dependencies (gproc), clean, compile and run erl with your binaries
+# in erl
+word_ladder_app:find("cold", "warm").
+currently when a process finds a solution, it kills the spawning process
+(erl shell I believe) which kills all other word processes. this means
+that the system doesn't run forever (using a fair bit of memory as it
+constructs some LONG chains) but also means that initialize needs to be
+called before each "find".
+produce dictionary file of 4 letter words:
cat /usr/share/dict/words | grep -e '^....$' > four_letter_words.txt
@@ -12,7 +12,7 @@ loop() ->
io:format("Solution! ~p~n", [Chain]),
exit("Found a solution"),
- {Link, Chain, Goal} when length(Chain) < 10 ->
+ {Link, Chain, Goal} ->
find_next_link(Link, Chain, Goal),

0 comments on commit 1deb216

Please sign in to comment.