Skip to content

Solution for the Practical 1.1 of the 2017 AI lecture at TUM

Notifications You must be signed in to change notification settings

benediktwerner/WordLadder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Word Ladder

This is my solution for the Practical 1 Part 1 of the AI lecture 2017 at TUM. The program creates a word ladder from a starting word to a goal word.

You start from a starting word and at each step you are only allowed to either add or remove a letter from the word and after that rearange all the letters in the resulting word. This new word must also be a valid English word. The objective is to take as few steps as possible to reach the goal word.

To use the program just run ladder.py startword endword. The result will be written to the console and to a file output.txt. If no solution exists the output file will be empty. For example if your run ladder.py lead gold the result will be:

lead
lad
load
old
gold

On the first run the program will precompute the neighboring words and write this information to a file data.gz. To precompute the data beforehand just call ladder.py precompute.

All allowed words are read form a file wordList.txt. An example file with about 100.000 English words is provided, but you can swap the file to use more words or a differente language.

About

Solution for the Practical 1.1 of the 2017 AI lecture at TUM

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages