def section_2(verbose): ''' Finds the top 3 classes. Returns a list of 3 class words. In case of a tie, returns a longer list. Active Passive Know Mage Seer Change Witch Heir Destroy Prince Bard Steal Thief Rogue Create Maid Sylph Exploit Knight Page Know vs. Change Create vs. Destroy Steal vs. Exploit ''' # lists of active and passive classes active = ['mage', 'witch', 'prince', 'thief', 'maid', 'knight'] passive = ['seer', 'heir', 'bard', 'rogue', 'sylph', 'page'] # Prints beginning part print("------------") print("This is Section 2 of the 4-part Class/Aspect Quiz.") print("There are 48 questions in this section.") print("Respond to these statements about yourself on a scale of 1 to 5,") print("with 1 meaning 'not at all' and 5 meaning 'very much'.") print("------------") # Questions, as q objects, with classpects listed questions = [0] * 48 # 48 questions questions[0] = classpect_quiz.q("Information can be a powerful tool, and I know how to use it.") questions[0].classpect = ['mage'] questions[1] = classpect_quiz.q("I decide what to do for myself.") questions[1].classpect = ['mage'] questions[2] = classpect_quiz.q("As long as I understand what I'm doing, it doesn't matter if others do.") questions[2].classpect = ['mage'] questions[3] = classpect_quiz.q("I try to see patterns and the flow of things.") questions[3].classpect = ['seer'] questions[4] = classpect_quiz.q("I find others come to me when they want to learn about something.") questions[4].classpect = ['seer'] questions[5] = classpect_quiz.q("While I generally have a good understanding of the situation, I don't like to take control.") questions[5].classpect = ['seer'] questions[6] = classpect_quiz.q("I have always had an intuitive understanding of the world.") questions[6].classpect = ['mage', 'seer'] questions[7] = classpect_quiz.q("I shape the situation around me to get the change I desire.") questions[7].classpect = ['witch'] questions[8] = classpect_quiz.q("If something needs doing, I am the one who gets it done.") questions[8].classpect = ['witch'] questions[9] = classpect_quiz.q("I don't like standing back when exciting things are happening.") questions[9].classpect = ['witch'] questions[10] = classpect_quiz.q("I find myself inspiring others.") questions[10].classpect = ['heir'] questions[11] = classpect_quiz.q("While I don't often take the wheel, I like to help others do so.") questions[11].classpect = ['heir'] questions[12] = classpect_quiz.q("I find that the things I change often change me as well.") questions[12].classpect = ['heir'] questions[13] = classpect_quiz.q("I am afraid of stagnation.") questions[13].classpect = ['witch', 'heir'] questions[14] = classpect_quiz.q("Sometimes I find myself burning more bridges than necessary.") questions[14].classpect = ['prince'] questions[15] = classpect_quiz.q("I have trouble controlling my destructive impulses.") questions[15].classpect = ['prince'] questions[16] = classpect_quiz.q("I can get things done, but often let it fail afterwards.") questions[16].classpect = ['prince'] questions[17] = classpect_quiz.q("I can find the flaws in just about anything.") questions[17].classpect = ['bard'] questions[18] = classpect_quiz.q("I am an expert at ferreting out weakness and using that as an advantage.") questions[18].classpect = ['bard'] questions[19] = classpect_quiz.q("Jokes that have a little bite are the best kind.") questions[19].classpect = ['bard'] questions[20] = classpect_quiz.q("I tear down challenges like they are paper.") questions[20].classpect = ['prince', 'bard'] questions[21] = classpect_quiz.q("I often find myself hoarding things.") questions[21].classpect = ['thief'] questions[22] = classpect_quiz.q("I like to dominate resources, so I can allocate a little extra to myself.") questions[22].classpect = ['thief'] questions[23] = classpect_quiz.q("If I want something, I will have it by any means necessary.") questions[23].classpect = ['thief'] questions[24] = classpect_quiz.q("I prefer to get things moving with a light touch rather than a shove.") questions[24].classpect = ['rogue'] questions[25] = classpect_quiz.q("I like to keep the good things flowing, and my friends thank me for it.") questions[25].classpect = ['rogue'] questions[26] = classpect_quiz.q("I often sneakily manipulate events to help those that need it most.") questions[26].classpect = ['rogue'] questions[27] = classpect_quiz.q("It's not always wrong to take something that isn't yours.") questions[27].classpect = ['thief', 'rogue'] questions[28] = classpect_quiz.q("When I see something going wrong, I try to step in and fix the problem.") questions[28].classpect = ['maid'] questions[29] = classpect_quiz.q("I like to create new things; I hate seeing things around me fall to pieces.") questions[29].classpect = ['maid'] questions[30] = classpect_quiz.q("If there is a problem, I can usually create a solution.") questions[30].classpect = ['maid'] questions[31] = classpect_quiz.q("People often come to me for help with their problems.") questions[31].classpect = ['sylph'] questions[32] = classpect_quiz.q("I would rather give advice than deal with my own issues.") questions[32].classpect = ['sylph'] questions[33] = classpect_quiz.q("I use my talents to smooth things over quietly.") questions[33].classpect = ['sylph'] questions[34] = classpect_quiz.q("I can't stand the thought of tossing things aside just because they are broken.") questions[34].classpect = ['maid', 'sylph'] questions[35] = classpect_quiz.q("I find creative and elegant solutions using minimal resources.") questions[35].classpect = ['knight'] questions[36] = classpect_quiz.q("I find myself exploiting loopholes to make things work.") questions[36].classpect = ['knight'] questions[37] = classpect_quiz.q("I use what I have on-hand to solve problems and get things done.") questions[37].classpect = ['knight'] questions[38] = classpect_quiz.q("I might be lacking now, but I am working hard to be the best I can be.") questions[38].classpect = ['page'] questions[39] = classpect_quiz.q("I would prefer to help others fight rather than fight myself.") questions[39].classpect = ['page'] questions[40] = classpect_quiz.q("I often find myself lending others the strength they need to push on.") questions[40].classpect = ['page'] questions[41] = classpect_quiz.q("I don't have much; but what I do have, I use very well.") questions[41].classpect = ['knight', 'page'] questions[42] = classpect_quiz.q("I get shit done.") questions[42].classpect = active questions[43] = classpect_quiz.q("If you want it done right, you must do it yourself.") questions[43].classpect = active questions[44] = classpect_quiz.q("Nothing gets done if you expect others to do it for you.") questions[44].classpect = active questions[45] = classpect_quiz.q("I would rather help others than help myself.") questions[45].classpect = passive questions[46] = classpect_quiz.q("Being in the limelight isn't for me.") questions[46].classpect = passive questions[47] = classpect_quiz.q("Sometimes, it's more effective to delegate than to micromanage.") questions[47].classpect = passive shuffle(questions) # Ask Questions for question in questions: while True: answer = classpect_quiz.ask(question) if answer != False: # If valid input question.answer = answer break # Tally results mage = 0 witch = 0 prince = 0 thief = 0 maid = 0 knight = 0 seer = 0 heir = 0 bard = 0 rogue = 0 sylph = 0 page = 0 for question in questions: if 'mage' in question.classpect: mage = mage + question.answer if 'witch' in question.classpect: witch = witch + question.answer if 'prince' in question.classpect: prince = prince + question.answer if 'thief' in question.classpect: thief = thief + question.answer if 'maid' in question.classpect: maid = maid + question.answer if 'knight' in question.classpect: knight = knight + question.answer if 'seer' in question.classpect: seer = seer + question.answer if 'heir' in question.classpect: heir = heir + question.answer if 'bard' in question.classpect: bard = bard + question.answer if 'rogue' in question.classpect: rogue = rogue + question.answer if 'sylph' in question.classpect: sylph = sylph + question.answer if 'page' in question.classpect: page = page + question.answer d = {'mage':mage, 'witch':witch, 'prince':prince, 'thief':thief, 'maid':maid, 'knight':knight, 'seer':seer, 'heir':heir, 'bard':bard, 'rogue':rogue, 'sylph':sylph, 'page':page, 'legit_key':0} if verbose == True: print(d) results = ['legit_key', 'legit_key', 'legit_key'] # Initial values must be legit keys for d # Find the highest 3 values, copy their keys to results list for key in d: if d[key] >= d[results[0]]: results[0] = key for key in d: if key != results[0]: if d[key] >= d[results[1]]: results[1] = key for key in d: if key != results[0] and key != results[1]: if d[key] >= d[results[2]]: results[2] = key # Check for duplicates, add any to list for key in d: if key != results[0] and key != results[1] and key != results[2]: if d[key] == d[results[2]]: # If there is a tie, it is for last place results = results + [key] if verbose == True: print(results) return(results)
def section_1(verbose): ''' Finds the top 3 aspects. Returns a list of 3 aspects. In case of a tie, returns a longer list. Free Limited Cardinal Space Time Energy/Change Life Doom Responsibility Breath Blood People/Choice Heart Mind Information Void Light Belief/Poss. Hope Rage ''' # lists of free and limited aspects free = ['space', 'life', 'breath', 'heart', 'void', 'hope'] limited = ['time', 'doom', 'blood', 'mind', 'light', 'rage'] # Prints beginning part print("------------") print("This is Section 1 of the 4-part Class/Aspect Quiz.") print("There are 48 questions in this section.") print("Respond to these statements about yourself on a scale of 1 to 5,") print("with 1 meaning 'not at all' and 5 meaning 'very much'.") print("------------") # Questions, as q objects, with classpects listed questions = [0] * 48 # 48 questions questions[0] = classpect_quiz.q("I am patient.") questions[0].classpect = ['time'] questions[1] = classpect_quiz.q("Even though all good things come to an end, there is always a new beginning.") questions[1].classpect = ['time'] questions[2] = classpect_quiz.q("There is beauty in the fact that things change.") questions[2].classpect = ['time'] questions[3] = classpect_quiz.q("I am good with my hands.") questions[3].classpect = ['space'] questions[4] = classpect_quiz.q("I tend toward the physical rather than the abstract.") questions[4].classpect = ['space'] questions[5] = classpect_quiz.q("I like to travel, and am a good navigator.") questions[5].classpect = ['space'] questions[6] = classpect_quiz.q("With the proper movement and positioning, any trial can be overcome.") questions[6].classpect = ['time', 'space'] questions[7] = classpect_quiz.q("I like the chaos of nature.") questions[7].classpect = ['life'] questions[8] = classpect_quiz.q("I enjoy overcoming difficulties, and going outside normal rules to do it.") questions[8].classpect = ['life'] questions[9] = classpect_quiz.q("Growth and change is absolutely necessary in life.") questions[9].classpect = ['life'] questions[10] = classpect_quiz.q("I like figuring out how systems and patterns work, and using them to my advantage.") questions[10].classpect = ['doom'] questions[11] = classpect_quiz.q("I always feel a strong sense of cause and effect.") questions[11].classpect = ['doom'] questions[12] = classpect_quiz.q("I enjoy finding my limits and pushing them, even if it takes sacrifice to do so.") questions[12].classpect = ['doom'] questions[13] = classpect_quiz.q("I use the energy inside myself to accomplish my goals.") questions[13].classpect = ['life', 'doom'] questions[14] = classpect_quiz.q("I prefer to live a carefree lifestyle.") questions[14].classpect = ['breath'] questions[15] = classpect_quiz.q("I don't like being bound or tied down to commitments.") questions[15].classpect = ['breath'] questions[16] = classpect_quiz.q("Even if the end is certain, I will forge my own path to get there.") questions[16].classpect = ['breath'] questions[17] = classpect_quiz.q("Bonds with family and friends are of utmost importance.") questions[17].classpect = ['blood'] questions[18] = classpect_quiz.q("Societal restraints are necessary.") questions[18].classpect = ['blood'] questions[19] = classpect_quiz.q("I prefer to make alliances and form strong allegiances with those I trust.") questions[19].classpect = ['blood'] questions[20] = classpect_quiz.q("I often find my freedoms and responsibilities at odds.") questions[20].classpect = ['breath', 'blood'] questions[21] = classpect_quiz.q("I believe in the soul.") questions[21].classpect = ['heart'] questions[22] = classpect_quiz.q("Willpower and integrity will get me anywhere I need to be.") questions[22].classpect = ['heart'] questions[23] = classpect_quiz.q("I know who I am and what I feel.") questions[23].classpect = ['heart'] questions[24] = classpect_quiz.q("What people do is more important than what they feel inside.") questions[24].classpect = ['mind'] questions[25] = classpect_quiz.q("I often put aside my feelings to make important decisions.") questions[25].classpect = ['mind'] questions[26] = classpect_quiz.q("Sometimes I find myself putting on a mask.") questions[26].classpect = ['mind'] questions[27] = classpect_quiz.q("I like to know what makes people tick.") questions[27].classpect = ['heart', 'mind'] questions[28] = classpect_quiz.q("Sometimes it's better to keep it secret.") questions[28].classpect = ['void'] questions[29] = classpect_quiz.q("I can pull something from nothing.") questions[29].classpect = ['void'] questions[30] = classpect_quiz.q("I am good at hiding, and finding things that are hidden.") questions[30].classpect = ['void'] questions[31] = classpect_quiz.q("I seek out knowledge and truth.") questions[31].classpect = ['light'] questions[32] = classpect_quiz.q("I don't like it when secrets are kept from me.") questions[32].classpect = ['light'] questions[33] = classpect_quiz.q("Often I find myself explaining how things work to others.") questions[33].classpect = ['light'] questions[34] = classpect_quiz.q("I think luck plays a big role in how things turn out.") questions[34].classpect = ['void', 'light'] questions[35] = classpect_quiz.q("At heart, I am optimistic.") questions[35].classpect = ['hope'] questions[36] = classpect_quiz.q("The future is full of possibility.") questions[36].classpect = ['hope'] questions[37] = classpect_quiz.q("I often find it hard to narrow down my options to make a decision.") questions[37].classpect = ['hope'] questions[38] = classpect_quiz.q("I find it easy to eliminate choices until the best one remains.") questions[38].classpect = ['rage'] questions[39] = classpect_quiz.q("Most of the time, my way is the best way.") questions[39].classpect = ['rage'] questions[40] = classpect_quiz.q("Anger and fear are the best motivational force.") questions[40].classpect = ['rage'] questions[41] = classpect_quiz.q("One's perception of the future strongly affects how the future actually unfolds.") questions[41].classpect = ['hope', 'rage'] questions[42] = classpect_quiz.q("I prefer to leave my options open rather than settle down.") questions[42].classpect = free questions[43] = classpect_quiz.q("Making decisions is hard for me.") questions[43].classpect = free questions[44] = classpect_quiz.q("Sometimes a little chaos, mystery, and indecision is for the best.") questions[44].classpect = free questions[45] = classpect_quiz.q("I like to live a structured life.") questions[45].classpect = limited questions[46] = classpect_quiz.q("Having a plan for the future is for the best.") questions[46].classpect = limited questions[47] = classpect_quiz.q("Life would be better if everyone always followed the rules.") questions[47].classpect = limited shuffle(questions) # Ask Questions for question in questions: while True: answer = classpect_quiz.ask(question) if answer != False: # If valid input question.answer = answer break # Tally results space = 0 time = 0 life = 0 doom = 0 breath = 0 blood = 0 heart = 0 mind = 0 void = 0 light = 0 hope = 0 rage = 0 for question in questions: if 'space' in question.classpect: space = space + question.answer if 'time' in question.classpect: time = time + question.answer if 'life' in question.classpect: life = life + question.answer if 'doom' in question.classpect: doom = doom + question.answer if 'breath' in question.classpect: breath = breath + question.answer if 'blood' in question.classpect: blood = blood + question.answer if 'heart' in question.classpect: heart = heart + question.answer if 'mind' in question.classpect: mind = mind + question.answer if 'void' in question.classpect: void = void + question.answer if 'light' in question.classpect: light = light + question.answer if 'hope' in question.classpect: hope = hope + question.answer if 'rage' in question.classpect: rage = rage + question.answer d = {'space':space, 'time':time, 'life':life, 'doom':doom, 'breath':breath, 'blood':blood, 'heart':heart, 'mind':mind, 'void':void, 'light':light, 'hope':hope, 'rage':rage, 'legit_key':0} if verbose == True: print(d) results = ['legit_key', 'legit_key', 'legit_key'] # Find the highest 3 values, copy their keys to results list for key in d: if d[key] >= d[results[0]]: results[0] = key for key in d: if key != results[0]: if d[key] >= d[results[1]]: results[1] = key for key in d: if key != results[0] and key != results[1]: if d[key] >= d[results[2]]: results[2] = key # Check for duplicates, add any to list for key in d: if key != results[0] and key != results[1] and key != results[2]: if d[key] == d[results[2]]: # If there is a tie, it is for last place results = results + [key] if verbose == True: print(results) return(results)
def section_3(list_of_classes, list_of_aspects, verbose): ''' Randomly combines top 3 aspects and classes with active/passive distinctions. Returns the top 3+ combinations for further refinement in section 4. In case of a tie, asks more questions. Returns a list of 3+ complete titles. ''' print("------------") print("This is Section 3 of the 4-part Class/Aspect Quiz.") print("There are at least 27 questions in this section,") print("but if you are especially conflicted, there may be many more.") print("Respond to these statements about yourself on a scale of 1 to 5,") print("with 1 meaning 'not at all' and 5 meaning 'very much'.") print("------------") # Lists of words for each of the classes and aspects active_classes = ['mage', 'witch', 'prince', 'thief', 'maid', 'knight'] # Questions list questions = [] # Types of questions # Active active = [0] * 6 active[0] = "I <class> <aspect>" active[1] = "I <class> my personal <aspect>" active[2] = "My ability to <class> <aspect> has helped me in life" active[3] = "I often <class> <aspect> to get ahead" active[4] = "In my life, I try to <class> <aspect>" active[5] = "I <class> things through <aspect>" # Passive passive = [0] * 6 passive[0] = "My <aspect> helps me <class>" passive[1] = "I use my <aspect> to <class> others" passive[2] = "I help others use their <aspect> to <class> things" passive[3] = "I <class> <aspect> to affect those around me" passive[4] = "I work through others in order to <class> <aspect>" passive[5] = "I find it easier to <class> with the help of <aspect>" # Starts putting questions into list for k in range(3): # 3 questions for every classpect for element in list_of_classes: # If active if element in active_classes: for aspect in list_of_aspects: sentence_list = active[random.randrange(5)].split(' ') for k in range(len(sentence_list)): if sentence_list[k] == '<class>': word_list = dictionaries.words[element] sentence_list[k] = word_list[random.randrange(len(word_list) - 1)] if sentence_list[k] == '<aspect>': word_list = dictionaries.words[aspect] sentence_list[k] = word_list[random.randrange(len(word_list) - 1)] sentence = '' for k in range(len(sentence_list) - 1): sentence = sentence + sentence_list[k] + ' ' sentence = sentence + sentence_list[len(sentence_list) - 1] + '.' new_q = classpect_quiz.q(sentence) new_q.classpect = [element, aspect] questions = questions + [new_q] # If passive else: for aspect in list_of_aspects: sentence_list = passive[random.randrange(5)].split(' ') for k in range(len(sentence_list)): if sentence_list[k] == '<class>': word_list = dictionaries.words[element] sentence_list[k] = word_list[random.randrange(len(word_list) - 1)] if sentence_list[k] == '<aspect>': word_list = dictionaries.words[aspect] sentence_list[k] = word_list[random.randrange(len(word_list) - 1)] sentence = '' for k in range(len(sentence_list) - 1): sentence = sentence + sentence_list[k] + ' ' sentence = sentence + sentence_list[len(sentence_list) - 1] + '.' new_q = classpect_quiz.q(sentence) new_q.classpect = [element, aspect] questions = questions + [new_q] shuffle(questions) # Asks questions for question in questions: while True: answer = classpect_quiz.ask(question) if answer != False: # If valid input question.answer = answer break # Tally answers d = {} # {'title':value} results = [questions[0].classpect[0] + ' of ' + questions[0].classpect[1]] * 3 # List of top keys from question # Initialized to a valid key value, just the first one from questions for question in questions: title = str(question.classpect[0] + ' of ' + question.classpect[1]) if title in d.keys(): d[title] = d[title] + question.answer else: d[title] = question.answer if verbose == True: print(d) # Find the highest 3 values, copy their keys to results list for key in d: if d[key] >= d[results[0]]: results[0] = key for key in d: if key != results[0]: if d[key] >= d[results[1]]: results[1] = key for key in d: if key != results[0] and key != results[1]: if d[key] >= d[results[2]]: results[2] = key # Check for duplicates, add any to list for key in d: if key != results[0] and key != results[1] and key != results[2]: if d[key] == d[results[2]]: # If there is a tie, it is for last place results = results + [key] if verbose == True: print(results) return(results)