Mad Lib Project Notes
* school1. Overview
- We will need two files:
runandmadlibs.py. Madlibs. py will contain all the functions we use for generating the story and gathering input. It will follow our spec(see: programming specs). Effect and calculation will be seperated
1.1. Storing Words
In a madlib, we see things like ___(verb/noun, past tense, [plural], ["Something …"]. We need to recreate this kind of (placeholder?). We will do this with the class wordSpec.
Our answer will be in the class wordValue and that class will have our user's answer and the wordSpec of that word. Like a filled out madlib "Monkey (noun, [No tense], singular, "An animal".
1.2. Creating a prompt
This is pretty simple. We just need to join the fields in our spec to create something like "Enter [kind] ([tense;plural?;hint]):"
1.3. User Input
This should be pretty simple to implement. Just a simple for loop: go over every specification and ask for input with the creating prompt function we made.
1.4. Creating and replacing story
We need a storyTemplate class that stores our required words and the story. We need a list of wordSpec, and the story text. We will use {[kind][number]} for our placeholders, but anything works.
Then, we need to map our values to their keys. We create a dict where the entered wordValue's key is matched to the enetered value.
2. Running Module
This will be our 'runner'. We need it because we have more than one effect in our madlibs.py. Should just be a simple while loop that runs sections 1.1-4
3. Elsewhere
3.1. References
3.2. In my garden
Notes that link to this note (AKA backlinks).
