Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save kat-perreira/49d6a72864b229a2f58d7f5f862e97ff to your computer and use it in GitHub Desktop.
Save kat-perreira/49d6a72864b229a2f58d7f5f862e97ff to your computer and use it in GitHub Desktop.
Magical Madlibs--Harry Potter Edition created by kaimana_Cat - https://repl.it/@kaimana_Cat/Magical-Madlibs-Harry-Potter-Edition
#Collect user input
puts "**********************************"
puts "Magical Madlibs--Harry Potter Edition"
puts "***********************************"
print "Enter your name: "
user_name = gets.chomp
print "Now enter the name of a friend: "
friend_name = gets.chomp
clothes = []
animals = []
colors = []
songs = []
rubbish_words = []
adjectives = []
puts
puts "I'm gonna need you to enter 4 made-up words (example: Sawagawa): "
4.times do |i|
print " #{i+1}. "
non_word = gets.chomp
rubbish_words << non_word
end
puts
puts "Cool. Ok, now enter 4 animals:"
4.times do |i|
print " #{i+1}. "
animal_in = gets.chomp
animals << animal_in
end
puts
puts "Awesome! Now I need you to enter 4 types of clothes: "
4.times do |i|
print " #{i+1}. "
clothes_in = gets.chomp
clothes << clothes_in
end
puts
puts "Now 4 colors: "
4.times do |i|
print " #{i+1}. "
colors_in = gets.chomp
colors << colors_in
end
puts
puts "OK, now I need 4 adjectives (Remember: adjectives are describing words like \"furry\")"
4.times do |i|
print " #{i+1}. "
adj_in = gets.chomp
adjectives << adj_in
end
puts
puts "Almost done. Now enter 4 song titles:"
4.times do |i|
print " #{i+1}. "
songs_in = gets.chomp
songs << songs_in
end
#Output
puts
puts "Upon your arrival at Hogwart's School of Wichcraft and Wizardry,
you run into you friend #{friend_name} in the hallway outside the dining room. #{friend_name} says
to you \"Hey, #{user_name}! Wanna see a neat spell my brother taught me?\""
#ask user input for direction of the story
puts
puts "????????????????????????????????????????????"
print "Would you like to see a spell, Y or N: "
answer = gets.chomp.upcase
puts "????????????????????????????????????????????"
puts
if answer == "Y"
puts
puts
puts "#{friend_name} says \"Ok check this out!\""
puts "#{friend_name} pulls out their wand, points it at your #{clothes.sample} and says
\"Meowgato Furriloso!!!\""
puts "Suddenly, a tiny kitty appears on your #{clothes.sample}! It meows happily, notices a loose thread and starts batting at it."
puts
puts "You turn to #{friend_name} and say \"Thats so cool!!\""
puts "You both make your way to the dining hall laughing at the tiny kitty who continues to play."
puts
puts
puts
puts "************************************************************"
else
puts "#{friend_name} says \"It's ok, we should probably get into the dining hall\""
"****************************************************************"
puts
puts
puts
end
puts
puts
puts
houses = %w(Hufflepuff Griffendor Ravenclaw Slytherine )
user_house = houses.sample
puts "You and #{friend_name} enter the Great Hall and sit at your table
with your #{user_house} housemates."
if user_house == "Ravenclaw"
puts "You tell your friend \"I'm so excited to start classes and get to learning!\""
elsif user_house == "Griffendor"
puts "You tell your friend \"Gosh I really hope Harry Potter notices me this year im glad we're in the same house\""
elsif user_house == "Slytherine"
puts "You tell your friend \"Man I'm so happy we're not in the dorky other houses, we are so clearly the best.\""
elsif user_house == "Hufflepuff"
puts "You tell your friend \"I can't wait to see all our friends and ask them what they've been up to! I missed everyone so much!\""
else
puts "You tell your friend \"I'm so excited to start classes and get to learning!\""
end
puts
puts
puts "**********************************************"
puts "After the beginning of the year banquet, you return to your dorm."
puts "On the floor, you see a piece of crumpled up parchment with a spell."
#user input activate spell
puts "?????????????????????????????????????????????"
print "Would you like to try the spell Y or N? "
spell_choice = gets.chomp.downcase
behaviors = ["angry. ", "excited!", "hungry.", "sleepy", "loveable", "ADORABLE!"]
if spell_choice == "y"
spell_activated = "true"
while spell_activated == "true"
puts
puts
puts "In a strong comannding voice, you say \" #{rubbish_words.sample.upcase}, #{rubbish_words.sample.upcase}!!!\""
puts
puts "..."
puts "..."
puts "pooof"
puts "..."
puts "The smoke clears and you see a(n) #{adjectives.sample} #{colors.sample} #{animals.sample} wearing a #{colors.sample} #{clothes.sample} and singing \" #{songs.sample} \" appear before you!
It looks #{behaviors.sample}"
puts
puts
puts "Well that was quite interesting? Would you like to try the spell again? "
puts
puts
puts "???????????????????????????????????"
print "Recite the words again Y or N? "
recast_spell = gets.chomp.downcase
puts "???????????????????????????????????"
if recast_spell == "n"
puts "You decide you've had enough with spells of questionable orgin and go upstairs to bed. Wise choice."
spell_activated = "false"
end
end
else
puts "You decide to play it safe. After all, you never know who could have
left that parchment there, it could have been Fred or George or may be even
'You Know Who'. You make your way up to bed happy with your decision."
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment