Last active
May 27, 2018 19:51
-
-
Save goedel-gang/b14b9c19d88a70f647b2747c8fb68d86 to your computer and use it in GitHub Desktop.
revision
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
devices:Canon, Climax, Development, Fragmentation, Highlights, Hocif, Motif development, Repotition, Retrograde, unison | |
relationships:Accunilation, Counterpoint, Contact, Coupl ntzy, Contrast, Nanipulation of number, Lead and follow | |
techincal:Action content, Dynanic contant, Spatial content, Relationlhip content, Timing content, Rhythmic content | |
physical:Postuxo, Coordination, nobility, Extension, Mignnent, Control, suength, Isolation, Balance, Flaxibility | |
expressive:Choxeographic intention, Facial expression, Focul, Huaicality, Phrasinq, onjection, Sensicivity to others | |
mental:Movement memmory, Commitment, Concentxation, Confidence |
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
""" | |
My suggestion for how to approach this using more dictionaries, sets, files and | |
all that good stuff | |
""" | |
# instead of randint, to use later | |
from random import choice | |
# it's all much easier to organise/extend if you put data in a separate file: | |
with open("information.dat", "r") as infofile: | |
info = {category: list(map(str.strip, content.split(","))) | |
for category, content in | |
(line.strip().split(":", maxsplit=1) for line in infofile)} | |
info_pairs = list(info.items()) | |
# This produce a dictionary like this: | |
# {'devices': ['Canon', | |
# 'Climax', | |
# 'Development', | |
# 'Fragmentation', | |
# 'Highlights', | |
# 'Hocif', | |
# 'Motif development', | |
# 'Repotition', | |
# 'Retrograde', | |
# 'unison'], | |
# 'expressive': ['Choxeographic intention', | |
# 'Facial expression', | |
# 'Focul', | |
# 'Huaicality', | |
# 'Phrasinq', | |
# 'onjection', | |
# 'Sensicivity to others'], | |
# 'mental': ['Movement memmory', 'Commitment', 'Concentxation', 'Confidence'], | |
# 'physical': ['Postuxo', | |
# 'Coordination', | |
# 'nobility', | |
# 'Extension', | |
# 'Mignnent', | |
# 'Control', | |
# 'suength', | |
# 'Isolation', | |
# 'Balance', | |
# 'Flaxibility'], | |
# 'relationships': ['Accunilation', | |
# 'Counterpoint', | |
# 'Contact', | |
# 'Coupl ntzy', | |
# 'Contrast', | |
# 'Nanipulation of number', | |
# 'Lead and follow'], | |
# 'techincal': ['Action content', | |
# 'Dynanic contant', | |
# 'Spatial content', | |
# 'Relationlhip content', | |
# 'Timing content', | |
# 'Rhythmic content']} | |
# spelling errors due to laziness in transcription | |
while True: | |
# rather than lots of "if" statements, just use "choice" to select one | |
# random pair | |
name, words_list = choice(info_pairs) | |
print("Category: {!r}".format(name)) | |
# build a set of words to be guessed, so you can't just keep guessing the | |
# same one | |
words = set(words_list) | |
# list of guessed words for prompting | |
guessed = [] | |
# while there is anything left to guess | |
while words: | |
attempt = "" # always fails length check | |
while (not any(attempt.lower() in word.lower() for word in words) | |
or len(attempt) < 3): | |
# display current category, guessed items and # of items left to | |
# guess | |
attempt = input("{!r} -({})+{}. Make a guess: ".format(name, | |
", ".join(guessed), | |
len(words))) | |
to_remove = next(word for word in words if attempt.lower() in word.lower()) | |
print("correct! removing {} from the list".format(to_remove)) | |
words.remove(to_remove) | |
guessed.append(to_remove) | |
print("All together: {}".format(", ".join(words_list))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment