Python: crossword solver + dictionary file
This is a quick and dirty crossword solver that I wrote in python:
word=raw_input('Crossword Solver \nuse * as a wildcard: ')
f=open('dic.txt', 'r')
for line in f:
line=line.strip()
if len(line)==len(word):
good=1
pos=0
for letter in word:
if not letter=='*':
if not letter==line[pos]:
good=0
pos+=1
if good==1:
print line
f.close()
Example usage:
Crossword Solver
use * as a wildcard: *arn*val
carnival
The dictionary file I used is 608.2Kb with 80,368 english words and avaliable here


Very cool.
However, the line “if len(line)==len(word):”
has one too many indents.