Box Relatives

Thoughts about puzzles, math, coding, and miscellaneous

Anagram Word Ladders

| 0 comments

The most recent NPR puzzle was an anagram word ladder, and I thought I’d try my hand at finding a solution in Perl*. Well, I did it and I’d like to share the code with anyone who’s interested. You can find it here.

* Remember how I was going to be leaving Perl a while back? Yeah, that never happened.

As far as I know, this is the first coded-up solution to anagram word ladders publicly available. It relies on a breadth-first search, which has a few advantages: (1) it is guaranteed to find a solution if one exists, and (2) it will actually find all of the shortest solutions, up to anagrams of intermediate words. There were tons of short solutions to the AUTUMN-LEAVES puzzle from NPR, and I won’t post them here. But just as an example, here it is turning NINETY to EIGHTH (an old puzzle from Merl Reagle):

NINETY WITNEY* WHITEY EIGHTY EIGHTH
NINETY INTONE TOEING HOGTIE EIGHTH
NINETY WITNEY TEWING* WEIGHT EIGHTH
NINETY WITNEY WHITEY WEIGHT EIGHTH
NINETY WITNEY WHITEY EIGHTY EIGHTH
NINETY TYNING NIGHTY EIGHTY EIGHTH
NINETY NITERY* HINTER HITHER EIGHTH
NINETY NITERY HINTER HITHER EIGHTH
NINETY WITNEY WHITEN WEIGHT EIGHTH
NINETY INTONE ETHION HOGTIE EIGHTH
NINETY SENNIT THEINS EIGHTS EIGHTH
NINETY INTERN HINTER HITHER EIGHTH
NINETY TYNING* NIGHTY EIGHTY EIGHTH
NINETY WITNEY WHITEN WEIGHT EIGHTH
NINETY SENNIT INGEST EIGHTS EIGHTH

*Boy, does the Scrabble dictionary have some terrible words in it. Yecch.

I don’t know if anyone will find this code useful in any way, but there it is. And man, if someone wants to write it in C/C++ so it could run faster, that would be excellent. Anyway, enjoy!

Leave a Reply

Required fields are marked *.


This site uses Akismet to reduce spam. Learn how your comment data is processed.