Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ingredients = Hash.new
- potion = 0
- puts "Welcome to potion brewer! To make a health potion you must combine 4 TOF + 7 TOW + 2 AF. Let's get started.\n\n"
- puts "Here are some basic conversions:\n\n"
- puts "4 EON + 2 WOB = 3 AF + 4 TOW\n"
- puts "3 TOW + 1 TOF = 2 EON\n"
- puts "1 WOB + 2 AF = 1 TOF\n\n"
- puts "The program will now calculate the maximum amount of potions you can make given your ingredients.\n\n"
- puts "How many EON do you have?"
- ingredients["EON"] = gets.to_i
- puts "How many TOF do you have?"
- ingredients["TOF"] = gets.to_i
- puts "How many WOB do you have?"
- ingredients["WOB"] = gets.to_i
- puts "How many AF do you have?"
- ingredients["AF"] = gets.to_i
- puts "How many TOW do you have?"
- ingredients["TOW"] = gets.to_i
- # ==/== DEBUG ==/==
- #for name in ingredients.keys
- # puts "Great, you have #{ingredients[name]} " + name + "."
- #end
- #tof_left = ingredients["TOF"] % 4
- #tow_left = ingredients["TOW"] % 7
- #af_left = ingredients["AF"] % 2
- while (ingredients["TOF"] >= 4 and ingredients["TOW"] >= 7 and ingredients["AF"] >= 2)
- potion += 1
- ingredients["TOF"] -= 4
- ingredients["TOW"] -= 7
- ingredients["AF"] -= 2
- # ==/== DEBUG ==/==
- #puts "Potion created.."
- end
- puts "\n\nMade #{potion} potion(s).\n\n"
- for name in ingredients.keys
- puts "You have " + ingredients[name].to_s + " " + name + " left.\n\n"
- end
Advertisement
Add Comment
Please, Sign In to add comment