A blogger by the name of T Campbell recently posted an interesting read about Algebraic Crosswords. And at the end, T posts a $100 bounty for a computer program to help crossword constructors construct such crosswords. That’s right up my alley as both a programmer and a puzzle solver, so I threw together a quick Python script to do the job.
My program, named algxword, can be downloaded from my GitHub.
The usage is as follows:
Usage: ./algxword.py [OPTIONS...] WORDLIST FROM TO Finds all words in the file WORDLIST (which need not be sorted) which would continue to be words when substituting the substring FROM for the substring TO. Only words which contain FROM in them are considered. Both FROM and TO can be empty strings. If FROM is the empty string, then TO is added at each position in the string to test for a word. If TO is the empty string, then the FROM string is simply deleted. Ordinarily, only the first occurrence of FROM is replaced with TO. If the -a option is specified, then all occurrences of FROM are replaced with TO. OPTIONS: -a Replaces all occurrences of FROM with TO when testing for a word --help Prints this help message
# Find all words which remain words when substituting the first occurrence of # 'qu' for 'k' in the word list /usr/share/dict/words python algxword.py /usr/share/dict/words qu k # Same as above, but replace all occurrences of 'qu' for 'k' python algxword.py -a /usr/share/dict/words qu k # Find all words which can have an 'lax' inserted in them python algxword.py /usr/share/dict/words "" lax
More detailed instructions for the less command line-savvy can be found in the included README file.
The download location has been moved to GitHub. I also relicensed it under a BSD-like license instead of the GNU GPL.