I blame moominmolly.
Feb. 28th, 2008 01:33 am$ ./lcwg.rb bike vole bike dike fike hike kike like mike pike sike sake bake cake fake hake jake lake make nake rake take wake woke boke coke doke joke loke moke poke roke soke toke yoke yore bore core fore gore kore lore more pore sore tore wore ware bare care dare fare gare hare mare pare rare sare tare vare yare yere bere cere dere here mere qere sere were wire aire dire fire hire lire mire sire tire vire vice bice dice fice mice nice pice rice sice tice wice wace dace face lace mace nace pace race rafe safe sife fife life nife rife wife wide aide bide fide hide lide mide nide ride side tide tade bade cade dade fade gade hade jade lade made sade vade wade yade yede cede lede mede rede wede wode bode code dode gode lode mode node rode tode tobe dobe lobe robe ribe gibe jibe kibe kipe hipe pipe ripe sipe tipe wipe wype gype rype type tape cape gape jape nape pape rape rope cope dope hope lope mope nope pope sope tope tole
There may be some opportunities for optimization.
no subject
Date: 2008-02-28 11:49 am (UTC)bile
bole
vole
Yeah, a shorter path exists.
no subject
Date: 2008-02-28 01:35 pm (UTC)alternately, you could get smarter about not replacing the same letter twice in a row; i.e. if the last move you made was to replace letter #1, then only look for #2 #3 and #4 this time. that will prune the search tree some, too.
i was sort of wondering if someone had done this :)
no subject
Date: 2008-02-28 01:39 pm (UTC)In its current state the algorithm is actually almost certain to find the longest possible path for any given set of words, which is itself sort of a neat trick.
no subject
Date: 2008-02-29 02:04 am (UTC)Amusing as hell, though.
no subject
Date: 2008-02-28 02:47 pm (UTC)it would be much more useful to turn a vole into a bike.
no subject
Date: 2008-02-28 04:33 pm (UTC)*twitch*
*not using this as an excuse to learn Ruby. today. instead of working.*
*twitch*
no subject
Date: 2008-02-28 04:52 pm (UTC)And I'm sure you know this, but all in all I'd just as soon be using Scheme. :-)
no subject
Date: 2008-02-28 05:16 pm (UTC)(Hmm, I haven't asked them about this in a while. Maybe it's time to pose the question again.)
no subject
Date: 2008-02-28 06:13 pm (UTC)My own reaction is that Ruby seems like it would be a perfectly nice little language if it hadn't gotten all this syntax all over it.
Ruby does some nice things: for example, just about everything, including array references and assignment, is implemented under the hood as a method. That allows you to override operations in base classes very cleanly, so that a statement like, say, "foo[bar] = baz" might update a database rather than modify an array.
Then it also does some totally crack-addled things. I have a rant waiting to get out about this, but it implements at least two kinds of procedural objects: closures and "blocks". A block is a chunk of executable code but it's not closed over its lexical environment. It's not a first-class object and you can't just pass it around between functions; it plays a special role in the language syntax. You cannot supply a method or a closure where the syntax demands a block. There are ways of extracting a block from a closure but they are very arcane. I'm mystified why anyone would write a language like this except out of pure orneriness.
no subject
Date: 2008-02-28 08:43 pm (UTC)No! Really! That result is pretty good! You should always use that program when playing against me. *nod*