Fix WordLadder (extension of [https://github.com/LeonGuertler/TextArena/pull/59](old pr)) #63
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
WordLadder but more efficient and harder words
depends slightly on the changes in env.utils.word_lists but a more general change
fixes the graph algorithm to work better for hard words
The old hard mode was actually easier than the easy mode because the adjacencies were found in the adjacency graph made from basic words only (thus more sparse)
New mode uses larger list of words to determine adjacency...
To do so uses more efficient algorithms
Examples before / after
Easy [before] gold -> band
['gold', 'cold', 'cord', 'card', 'hard', 'hand', 'band'] ❌ (intended)
['gold', 'bold', 'bond', 'band'] ✅ (easily found)
Easy [after] page -> mass
['page', 'pate', 'bate', 'bats', 'bass', 'mass']
Medium [before] sky -> law
['sky', 'say', 'ray', 'rat', 'cat', 'cut', 'nut', 'not', 'now', 'low', 'law'] ❌
['sky', 'say', 'lay', 'law'] ✅
Medium [after] work from ['work', 'cork', 'corp', 'coop', 'clop', 'flop', 'flog', 'frog', 'from']
Hard [before] rod -> cow
['rod', 'red', 'bed', 'bad', 'sad', 'say', 'ray', 'rat', 'cat', 'cut', 'nut', 'not', 'now', 'cow']❌
['rod', 'cod', 'cow'] ✅
Hard [after] shame -> loose
['shame', 'shale', 'stale', 'stile', 'stilt', 'stint', 'saint', 'paint', 'point', 'joint', 'joist', 'joust', 'roust', 'rouse', 'louse', 'loose']