Skip to content

Instantly share code, notes, and snippets.

@Grissess
Created November 28, 2015 22:38
Show Gist options
  • Save Grissess/97576d59081acaa76e81 to your computer and use it in GitHub Desktop.
Save Grissess/97576d59081acaa76e81 to your computer and use it in GitHub Desktop.
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