Project #3: Story
Tell a procedurally generated story
Write methods to select random words using Math.random() and conditionals
Have a storyteller put them together in a mad-lib style story for the user
STEP BY STEP
Part A - Planning
Design a story you would like to tell. It should be pretty short - a sentence or two.
Feel free to retheme this! It could be a dinner-suggestion application, a program to describe a weird piece of art, or a D&D Character Concept Generator.
Your story must have at least five different elements that vary, each with at least five different choices. For example:
[Actor] [actioned] [emotioning] the [adjective] and [adjective] [danger].
"I ran far away, fearing the terrifying and capricious swarm of bees."
"Vladimir danced the night away, honoring the mighty and majestic axe-murderer."
[Name] grew up in [modest location], but always dreamt of becoming a [job] in the [dramatic location]... If only they could overcome their struggle with [obstacle].
Jon Snow grew up in The Shire, but always dreamt of becoming a jedi in New York City. If only they could overcome their struggle with tax evasion."
"Dora the Explorer grew up in a small town, but always dreamt of becoming a sous-chef in Gondor. If only they could overcome their struggle with restless leg syndrome."
Calling a method twice does not count as an extra element - you still need five different random things.
If you are clever, you can find a way to store data to match a pronoun to a name. This is an optional challenge! If not,it's acceptable to use a gender-neutral pronoun or repeat the name.
At this stage, you'll rewrite the sample sentence in Main to match your story. Rename the two partially-written methods to fit accordingly.
Part B - First Element
Fix one of the random generation elements so that it returns five different possible values.
You'll need to use Math.random() and casting to make this work!
Make sure that you get all five values. It's common to have an off-by-one-error and never get all of them.
Part C - Other Elements
Repeat the process for your other five random elements
EXAMPLE: RUNNING PROGRAM
Note: Color isn't required, it's just being used here to show which parts are from which random set. But if you want to use color and can learn it on your own, that's a great extra credit opportunity!
I ran far away, fearing the terrifying and capricious swarm of bees.
Vladimir danced the night away, honoring the mighty and majestic axe-murderer.
Karel danced the night away, loving the capricious and tall bugbear.
I ate tacos all night, fearing the mighty and mighty capybara.
Jeffrey Bezos engaged in cold-war style espionage, enraging the terrifying and tall jar of applesauce.