Created
November 28, 2015 22:38
-
-
Save Grissess/97576d59081acaa76e81 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
all_poss = set("about after again below could every first found great house large learn never other place plant point right small sound spell still study their there these thing think three water where which world would write".split(' ')) | |
def poss_matches(poss, dial, dialpos): | |
return set([i for i in poss if i[dialpos] in dial]) | |
def interact(prompt): | |
curr = all_poss | |
for i in xrange(5): | |
while True: | |
try: | |
dialpos = int(prompt('Enter dial pos [0, 4]: ')) | |
except Exception: | |
pass | |
else: | |
break | |
chars = prompt('All characters on dial %d: '%(dialpos,)) | |
curr = poss_matches(curr, chars.lower(), dialpos) | |
print 'Matches at this stage:' | |
print curr | |
if __name__ == '__main__': | |
interact(raw_input) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment