From f42247b8528588f979a5ef336b4c579626821da2 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Mon, 25 Feb 2019 15:19:06 -0800 Subject: [PATCH 1/9] Creates a class for planets --- planet.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 planet.rb diff --git a/planet.rb b/planet.rb new file mode 100644 index 00000000..ac305b78 --- /dev/null +++ b/planet.rb @@ -0,0 +1,16 @@ +cdclass Planet + attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact + def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) + @name = name + @color = color + @mass_kg = mass_kg + @distance_from_sun_km = distance_from_sun_km + @fun_fact = fun_fact + end + def manifest_spheres + @planetary_array = [] + end + def summary + return "#{@name} has a #{@color} color and mass of #{@mass_kg}. It is #{@distance_from_sun_km} away from the sun and next time you're at a cool party, you should definitely mention that #{@fun_fact}" + end +end From d5134b3799b295afca2780f96c364ea74c77cff7 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Mon, 25 Feb 2019 15:20:00 -0800 Subject: [PATCH 2/9] Sets up for a driver program --- main.rb | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 main.rb diff --git a/main.rb b/main.rb new file mode 100644 index 00000000..f007d00e --- /dev/null +++ b/main.rb @@ -0,0 +1,16 @@ +require_relative 'planet' + +def greeting +end + +def manifest_spheres +end + +def user_chooser +end + +def planet_picker +end + +def adventure +end From cd4521f331343a3824e91daf2e57ee0f2ad96498 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Mon, 25 Feb 2019 18:03:40 -0800 Subject: [PATCH 3/9] adds to method (solar system) --- main.rb | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/main.rb b/main.rb index f007d00e..0b4d253b 100644 --- a/main.rb +++ b/main.rb @@ -1,16 +1,35 @@ require_relative 'planet' +require_relative 'solar_system' +require 'colorize' -def greeting -end +def main +p1 = Planet.new("Plutern", "basil green", 494, 1209, "Plutern was the first planet ever recorded by the process of mechanical scopeometry") +p2 = Planet.new("Eantune", "yolky", 332, 785, "Eantune represents simulacrity in the astrological divination system of the people of Plutern") +solar_system = SolarSystem.new('Sun 4') +solar_system.add_planet(p1) +solar_system.add_planet(p2) -def manifest_spheres -end +list = solar_system.list_planets -def user_chooser -end +found_planet = solar_system.find_planet_by_name("eantune") -def planet_picker +puts list +puts found_planet +puts found_planet.summary end +main +# def greeting +# end + +# def manifest_spheres +# end + +# def user_chooser +# end + +# def planet_picker +# end + def adventure end From 541d130bb9d125774fac9488e11e568b2f79a8a7 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Mon, 25 Feb 2019 18:14:22 -0800 Subject: [PATCH 4/9] Solar_System class functionality --- main.rb | 4 ---- planet.rb | 6 ++++-- solar_system.rb | 29 +++++++++++++++++++++++++++++ 3 files changed, 33 insertions(+), 6 deletions(-) create mode 100644 solar_system.rb diff --git a/main.rb b/main.rb index 0b4d253b..dca366d7 100644 --- a/main.rb +++ b/main.rb @@ -1,6 +1,5 @@ require_relative 'planet' require_relative 'solar_system' -require 'colorize' def main p1 = Planet.new("Plutern", "basil green", 494, 1209, "Plutern was the first planet ever recorded by the process of mechanical scopeometry") @@ -8,11 +7,8 @@ def main solar_system = SolarSystem.new('Sun 4') solar_system.add_planet(p1) solar_system.add_planet(p2) - list = solar_system.list_planets - found_planet = solar_system.find_planet_by_name("eantune") - puts list puts found_planet puts found_planet.summary diff --git a/planet.rb b/planet.rb index ac305b78..a440e001 100644 --- a/planet.rb +++ b/planet.rb @@ -1,4 +1,4 @@ -cdclass Planet +class Planet attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) @name = name @@ -11,6 +11,8 @@ def manifest_spheres @planetary_array = [] end def summary - return "#{@name} has a #{@color} color and mass of #{@mass_kg}. It is #{@distance_from_sun_km} away from the sun and next time you're at a cool party, you should definitely mention that #{@fun_fact}" + puts "\n#{@name} has a #{@color} color and mass of #{@mass_kg}x10^24 kg." + puts "It is #{@distance_from_sun_km}x10^6 km away from the sun." + puts "#{@fun_fact}." end end diff --git a/solar_system.rb b/solar_system.rb new file mode 100644 index 00000000..d3fdb315 --- /dev/null +++ b/solar_system.rb @@ -0,0 +1,29 @@ +class SolarSystem + attr_reader :star_name, :planets + + def initialize(star_name) + @star_name = star_name + @planets = [] + end + + def add_planet(planet) + @planets << planet + end + + def list_planets + @list = "" + @planets.length.times do |i| + @list = @list + "\n#{i+1}. #{@planets[i].name}" + end + return "Planets orbiting #{@star_name}: #{@list}" + end + + def find_planet_by_name(name) + @planets.length.times do |i| + if @planets[i].name.upcase == name.upcase + return @planets[i] + end + end + end + +end \ No newline at end of file From 2dd1f2d37c6cc76dd1acf4f49cfdbc33af7752bb Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Wed, 27 Feb 2019 02:58:24 -0800 Subject: [PATCH 5/9] Well, I broke it. CLI and busted methods. --- main.rb | 70 ++++++++++++++++++++++++++++++++++--------------- planet.rb | 18 ++++++++----- solar_system.rb | 59 +++++++++++++++++++++++++++++++++++------ 3 files changed, 112 insertions(+), 35 deletions(-) diff --git a/main.rb b/main.rb index dca366d7..85344746 100644 --- a/main.rb +++ b/main.rb @@ -1,31 +1,59 @@ require_relative 'planet' require_relative 'solar_system' +require 'faker' +require 'ruby_figlet' +require 'colorize' +require 'rubygems' +require 'highline/import' def main -p1 = Planet.new("Plutern", "basil green", 494, 1209, "Plutern was the first planet ever recorded by the process of mechanical scopeometry") -p2 = Planet.new("Eantune", "yolky", 332, 785, "Eantune represents simulacrity in the astrological divination system of the people of Plutern") -solar_system = SolarSystem.new('Sun 4') -solar_system.add_planet(p1) -solar_system.add_planet(p2) -list = solar_system.list_planets -found_planet = solar_system.find_planet_by_name("eantune") -puts list -puts found_planet -puts found_planet.summary -end + @solar_system = SolarSystem.new(Faker::Space.star) + + autofactoid = [ + "On #{@name}, an atmospheric event called a #{Faker::Games::Pokemon.move} is a rare but spectacular sensory experience, causing a thick, soupy #{Faker::Color.color_name} cloud of #{Faker::Coffee.notes}-scented mist to roll over the surface of the planet", + "#{@name} was first spotted by an unnamed #{Faker::Military.marines_rank} working for the #{Faker::Space.agency} who originally named it #{Faker::Movies::Hobbit.character} in honor of the office dog. The name was only changed to #{@name} in #{rand(1900...1999)}", "#{Faker::GreekPhilosophers.name} famously postulated that #{@planet} was merely a rumor" + ] -main -# def greeting -# end + 6.times do + new_planet = Planet.new(Faker::Books::Dune.unique.planet, Faker::Color.color_name, rand(100...10000), rand(100...10000), autofactoid.sample) + @solar_system.add_planet(new_planet) +end -# def manifest_spheres -# end +def control_loop + begin + puts "\n\n" + loop do + choose do |menu| + menu.prompt = "\nPlease select your option: " + menu.choice("List Planets") { @solar_system.list_planets } + menu.choice("Planet Summary") { @solar_system.elucidate } + menu.choice("Add a New Planet") { @solar_system.user_add_planet(@solar_system) } + menu.choice("Quit") { exit } + end + end + end +end -# def user_chooser -# end +# Start the control loop. +puts "Welcome to ...\n\n" +sleep 2 +puts <<-'EOF' + ▀▄ ▄▀ ▄▄▄████▄▄▄ ▄██▄ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀ +EOF +sleep 1 +puts <<-'EOF' + ▄█▀███▀█▄ ███▀▀██▀▀███ ▄█▀██▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ + █▀███████▀█ ▀▀███▀▀███▀▀ ▀█▀██▀█▀ █▀███████▀█ █▀███████▀█ █▀███████▀█ +EOF +sleep 1 +puts <<-'EOF' + ▀ ▀▄▄ ▄▄▀ ▀ ▀█▄ ▀▀ ▄█▀ ▀▄ ▄▀ ▀ ▀▄ ▄▀ ▀ ▀ ▀▄▄ ▄▄▀ ▀▄ ▄▀ <3 -# def planet_picker -# end +EOF -def adventure + space_title = RubyFiglet::Figlet.new " +o u t e r * s p a c e", 'basic' +space_title.show +control_loop end +main \ No newline at end of file diff --git a/planet.rb b/planet.rb index a440e001..3cc849c0 100644 --- a/planet.rb +++ b/planet.rb @@ -1,18 +1,24 @@ +require 'faker' + class Planet attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact + def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) @name = name @color = color @mass_kg = mass_kg @distance_from_sun_km = distance_from_sun_km @fun_fact = fun_fact + if @mass_kg <= 0 || distance_from_sun_km <= 0 + raise ArgumentError, "Neither kilograms nor kilometers can be zero." + end end - def manifest_spheres - @planetary_array = [] - end + def summary - puts "\n#{@name} has a #{@color} color and mass of #{@mass_kg}x10^24 kg." - puts "It is #{@distance_from_sun_km}x10^6 km away from the sun." - puts "#{@fun_fact}." + return + "\n#{@name} has a #{@color} color and mass of #{@mass_kg}x10^24 kg." + + "\nIt is #{@distance_from_sun_km}x10^6 km away from the sun." + + "#{@fun_fact}." end end + diff --git a/solar_system.rb b/solar_system.rb index d3fdb315..de8fb90a 100644 --- a/solar_system.rb +++ b/solar_system.rb @@ -10,20 +10,63 @@ def add_planet(planet) @planets << planet end - def list_planets - @list = "" - @planets.length.times do |i| - @list = @list + "\n#{i+1}. #{@planets[i].name}" + def user_add_planet(solar_system) + puts "\nAdding a planet is for scientists ONLY. Are you a real scientist? (Y/N)" + y_n = gets.chomp.upcase + if y_n == "N" + control_loop + elsif y_n == "Y" + puts "" + else + control_loop + end + puts "Please provide some data:" + p "Name of planet: " + name = gets.chomp + p "Planetary mass in kilograms/10^24?" + mass_kg = gets.chomp.to_f + p "Orbital radius in kilometers/10^22:" + distance_from_sun = gets.chomp.to_f + p "Frivolous detail (REQUIRED): " + fun_fact = gets.chomp + p "Surface color: " + name = gets.chomp + begin + new_planet = Planet.new(name, color, mass_kg, distance_from_sun, fun_fact) + solar_system.add_planet(new_planet) + rescue ArgumentError => error + puts "\nIllogical planetary data. Try again.".colorize(:red) + puts error.message + else + puts "\nThank you for the science.\n" end - return "Planets orbiting #{@star_name}: #{@list}" end + def list_planets + @list = "" + @planets.length.times do |i| + @list = @list + "\n#{i+1}. #{@planets[i].name}" + end + puts "The #{@star_name} system includes: #{@list}" + puts + end +#Broken, can't get this to work. def find_planet_by_name(name) - @planets.length.times do |i| - if @planets[i].name.upcase == name.upcase - return @planets[i] + if @planets.count { |i| (i.name == name) } > 0 + found_planets = @planets.select { |i| (i.name == name) } + found_planets.each do |i| + puts i.summary end + else + puts "Sorry, no planet with that name found.".colorize(:red) + puts end end + def elucidate + print 'Enter planet name to read relevant scientific output: ' + planet_name = gets.chomp + find_planet_by_name(planet_name) + end + end \ No newline at end of file From 09778659b66878d9529345c9d588db7d8027de67 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Wed, 27 Feb 2019 19:07:29 -0800 Subject: [PATCH 6/9] Refactored and working driver --- main.rb | 123 ++++++++++++++++++++++++++++++++++++-------------------- 1 file changed, 79 insertions(+), 44 deletions(-) diff --git a/main.rb b/main.rb index 85344746..2de6f0c1 100644 --- a/main.rb +++ b/main.rb @@ -3,57 +3,92 @@ require 'faker' require 'ruby_figlet' require 'colorize' -require 'rubygems' -require 'highline/import' - -def main - @solar_system = SolarSystem.new(Faker::Space.star) +def colors(string) + string.chars.map {|char| char.colorize([:red, :cyan, :green, :blue].sample)}.join +end - autofactoid = [ - "On #{@name}, an atmospheric event called a #{Faker::Games::Pokemon.move} is a rare but spectacular sensory experience, causing a thick, soupy #{Faker::Color.color_name} cloud of #{Faker::Coffee.notes}-scented mist to roll over the surface of the planet", - "#{@name} was first spotted by an unnamed #{Faker::Military.marines_rank} working for the #{Faker::Space.agency} who originally named it #{Faker::Movies::Hobbit.character} in honor of the office dog. The name was only changed to #{@name} in #{rand(1900...1999)}", "#{Faker::GreekPhilosophers.name} famously postulated that #{@planet} was merely a rumor" - ] +def user_add_planet(solar_system) + puts "\nAdding a planet is for scientists ONLY. Are you a real scientist? (Y/N)" + y_n = gets.chomp.upcase + if y_n == "Y" + puts "" + puts "Please provide some data:" + print "Name of planet: " + name = gets.chomp + print "Surface color: " + color = gets.chomp + print "Planetary mass in kilograms/10^24?: " + mass_kg = gets.chomp.to_f + print "Orbital radius in kilometers/10^22: " + distance_from_sun = gets.chomp.to_f + fun_fact = "" + new_planet = Planet.new(name, color, mass_kg, distance_from_sun, fun_fact) + solar_system.add_planet(new_planet) + puts "\nThank you for the science.\n" + else + puts "Please try again with more scientific integrity." + end +end - 6.times do - new_planet = Planet.new(Faker::Books::Dune.unique.planet, Faker::Color.color_name, rand(100...10000), rand(100...10000), autofactoid.sample) - @solar_system.add_planet(new_planet) +def display_data(solar_system) + print "What is the name of the planet you wish to learn about? " + query = gets.chomp + found_planet = solar_system.find_planet_by_name(query) + return found_planet end -def control_loop - begin - puts "\n\n" - loop do - choose do |menu| - menu.prompt = "\nPlease select your option: " - menu.choice("List Planets") { @solar_system.list_planets } - menu.choice("Planet Summary") { @solar_system.elucidate } - menu.choice("Add a New Planet") { @solar_system.user_add_planet(@solar_system) } - menu.choice("Quit") { exit } +def main + solar_system = SolarSystem.new(Faker::Space.star) + + 8.times do |x| + new_planet = [] + new_planet[x] = Planet.new(Faker::Books::Dune.unique.planet, Faker::Color.color_name, rand(100...10000), rand(100...10000), "") + solar_system.add_planet(new_planet[x]) + x += 1 + end + + loooop = true + while loooop == true do + puts + puts colors("---------------------------------------------------------") + puts + puts "What would you like to do next?\n" + puts "1. List Planets".colorize(:green) + puts "2. See Planet Details".colorize(:blue) + puts "3. Add Planet".colorize(:magenta) + puts "4. Quit".colorize(:red) + puts + print "Enter the number of your choice: " + control = gets.chomp.to_i + case control + when 1 + puts "#{solar_system.list_planets}\n" + when 2 + the_query = display_data(solar_system) + puts colors(the_query.summary) + when 3 + user_add_planet(solar_system) + when 4 + puts "Goodbye!" + exit + else + puts "That is not a valid choice.\n\n".colorize(:red) end + puts colors("---------------------------------------------------------") + sleep 1 end - end end - -# Start the control loop. puts "Welcome to ...\n\n" -sleep 2 -puts <<-'EOF' - ▀▄ ▄▀ ▄▄▄████▄▄▄ ▄██▄ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀ -EOF -sleep 1 -puts <<-'EOF' - ▄█▀███▀█▄ ███▀▀██▀▀███ ▄█▀██▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ - █▀███████▀█ ▀▀███▀▀███▀▀ ▀█▀██▀█▀ █▀███████▀█ █▀███████▀█ █▀███████▀█ -EOF -sleep 1 -puts <<-'EOF' - ▀ ▀▄▄ ▄▄▀ ▀ ▀█▄ ▀▀ ▄█▀ ▀▄ ▄▀ ▀ ▀▄ ▄▀ ▀ ▀ ▀▄▄ ▄▄▀ ▀▄ ▄▀ <3 - -EOF - - space_title = RubyFiglet::Figlet.new " -o u t e r * s p a c e", 'basic' +sleep 0.5 +puts colors(" ▀▄ ▄▀ ▄▄▄████▄▄▄ ▄██▄ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀") +sleep 0.5 +puts colors(" ▄█▀███▀█▄ ███▀▀██▀▀███ ▄█▀██▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄") +sleep 0.6 +puts colors(" █▀███████▀█ ▀▀███▀▀███▀▀ ▀█▀██▀█▀ █▀███████▀█ █▀███████▀█ █▀███████▀█") +sleep 0.7 +puts colors(" ▀ ▀▄▄ ▄▄▀ ▀ ▀█▄ ▀▀ ▄█▀ ▀▄ ▄▀ ▀ ▀▄ ▄▀ ▀ ▀ ▀▄▄ ▄▄▀ ▀▄ ▄▀ <3") +puts "\n\n" +space_title = RubyFiglet::Figlet.new "o u t e r * s p a c e", 'basic' space_title.show -control_loop -end +puts "\n" main \ No newline at end of file From fb222819997d2defd41a92f217f55e30c3261826 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Wed, 27 Feb 2019 19:08:45 -0800 Subject: [PATCH 7/9] Sorted and working methods --- solar_system.rb | 65 +++++++++---------------------------------------- 1 file changed, 12 insertions(+), 53 deletions(-) diff --git a/solar_system.rb b/solar_system.rb index de8fb90a..124064e4 100644 --- a/solar_system.rb +++ b/solar_system.rb @@ -10,63 +10,22 @@ def add_planet(planet) @planets << planet end - def user_add_planet(solar_system) - puts "\nAdding a planet is for scientists ONLY. Are you a real scientist? (Y/N)" - y_n = gets.chomp.upcase - if y_n == "N" - control_loop - elsif y_n == "Y" - puts "" - else - control_loop - end - puts "Please provide some data:" - p "Name of planet: " - name = gets.chomp - p "Planetary mass in kilograms/10^24?" - mass_kg = gets.chomp.to_f - p "Orbital radius in kilometers/10^22:" - distance_from_sun = gets.chomp.to_f - p "Frivolous detail (REQUIRED): " - fun_fact = gets.chomp - p "Surface color: " - name = gets.chomp - begin - new_planet = Planet.new(name, color, mass_kg, distance_from_sun, fun_fact) - solar_system.add_planet(new_planet) - rescue ArgumentError => error - puts "\nIllogical planetary data. Try again.".colorize(:red) - puts error.message - else - puts "\nThank you for the science.\n" + def list_planets + planets_string = "\nPlanets orbiting #{@star_name}:\n" + @planets.each_with_index do |planet, i| + planets_string += "#{i+1}. #{planet.name} \n" end + return planets_string end - def list_planets - @list = "" - @planets.length.times do |i| - @list = @list + "\n#{i+1}. #{@planets[i].name}" - end - puts "The #{@star_name} system includes: #{@list}" - puts - end -#Broken, can't get this to work. - def find_planet_by_name(name) - if @planets.count { |i| (i.name == name) } > 0 - found_planets = @planets.select { |i| (i.name == name) } - found_planets.each do |i| - puts i.summary - end + def find_planet_by_name(query) + matches = @planets.select do |planet| + planet.name == query.capitalize + end + if matches == [] + raise ArgumentError, "Sorry, no planet called #{query} was found.".colorize(:red) else - puts "Sorry, no planet with that name found.".colorize(:red) - puts + return matches[0] end end - - def elucidate - print 'Enter planet name to read relevant scientific output: ' - planet_name = gets.chomp - find_planet_by_name(planet_name) - end - end \ No newline at end of file From 0044bb8c15b878b98c0564a9d9998e8d5ed4f22c Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Wed, 27 Feb 2019 19:09:45 -0800 Subject: [PATCH 8/9] Fully automated factoids --- planet.rb | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/planet.rb b/planet.rb index 3cc849c0..0dd92b08 100644 --- a/planet.rb +++ b/planet.rb @@ -1,24 +1,25 @@ require 'faker' +def autofactoid(planet_name) + return ["On #{planet_name}, an atmospheric event called a #{Faker::Games::Pokemon.move} is a rare but spectacular sensory experience, causing a thick, soupy #{Faker::Color.color_name} cloud of #{Faker::Coffee.notes}-scented mist to roll over the surface of the planet", + "#{planet_name} was first spotted by an unnamed #{Faker::Military.marines_rank} working for the #{Faker::Space.agency} who originally named it #{Faker::Movies::Hobbit.character} in honor of the office dog. The name was only changed to #{planet_name} in #{rand(1900...1999)}", "#{Faker::GreekPhilosophers.name} famously postulated that #{planet_name} was merely a rumor"].sample +end class Planet attr_reader :name, :color, :mass_kg, :distance_from_sun_km, :fun_fact def initialize(name, color, mass_kg, distance_from_sun_km, fun_fact) + raise ArgumentError.new("Kilograms invalid. Try again.") if mass_kg.to_i <= 0 + raise ArgumentError.new("Kilometers invalid. Try again.") if distance_from_sun_km.to_i <= 0 @name = name @color = color @mass_kg = mass_kg @distance_from_sun_km = distance_from_sun_km - @fun_fact = fun_fact - if @mass_kg <= 0 || distance_from_sun_km <= 0 - raise ArgumentError, "Neither kilograms nor kilometers can be zero." - end + @fun_fact = autofactoid(name) end def summary - return - "\n#{@name} has a #{@color} color and mass of #{@mass_kg}x10^24 kg." + + return ("\n#{@name} has a #{@color} color and mass of #{@mass_kg}x10^24 kg." + "\nIt is #{@distance_from_sun_km}x10^6 km away from the sun." + - "#{@fun_fact}." + "\n\n#{@fun_fact}.\n") end end - From 974d8a08e13e37da83a2b233e4b9f0bab5d1e432 Mon Sep 17 00:00:00 2001 From: Kate Sandler Date: Wed, 27 Feb 2019 21:55:08 -0800 Subject: [PATCH 9/9] Made double sure it wasn't broken. --- main.rb | 16 ++++++++-------- planet.rb | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/main.rb b/main.rb index 2de6f0c1..86aaab65 100644 --- a/main.rb +++ b/main.rb @@ -4,7 +4,7 @@ require 'ruby_figlet' require 'colorize' def colors(string) - string.chars.map {|char| char.colorize([:red, :cyan, :green, :blue].sample)}.join + string.chars.map {|char| char.colorize([:light_red, :light_cyan, :light_green, :light_blue].sample)}.join end def user_add_planet(solar_system) @@ -50,7 +50,7 @@ def main loooop = true while loooop == true do puts - puts colors("---------------------------------------------------------") + puts colors("-----------------------------------------------------------") puts puts "What would you like to do next?\n" puts "1. List Planets".colorize(:green) @@ -74,21 +74,21 @@ def main else puts "That is not a valid choice.\n\n".colorize(:red) end - puts colors("---------------------------------------------------------") + puts colors("------------------------------------------------------------") sleep 1 end end puts "Welcome to ...\n\n" sleep 0.5 -puts colors(" ▀▄ ▄▀ ▄▄▄████▄▄▄ ▄██▄ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀") +puts colors(" ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀ ▀▄ ▄▀") sleep 0.5 -puts colors(" ▄█▀███▀█▄ ███▀▀██▀▀███ ▄█▀██▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄") +puts colors(" ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄ ▄█▀███▀█▄") sleep 0.6 -puts colors(" █▀███████▀█ ▀▀███▀▀███▀▀ ▀█▀██▀█▀ █▀███████▀█ █▀███████▀█ █▀███████▀█") +puts colors(" █▀███████▀█ ▀▀███▀▀███▀▀ █▀███████▀█ █▀███████▀█") sleep 0.7 -puts colors(" ▀ ▀▄▄ ▄▄▀ ▀ ▀█▄ ▀▀ ▄█▀ ▀▄ ▄▀ ▀ ▀▄ ▄▀ ▀ ▀ ▀▄▄ ▄▄▀ ▀▄ ▄▀ <3") +puts colors(" ▀ ▀▄▄ ▄▄▀ ▀ ▀█▄ ▄█▀ ▀▄ ▄▀ ▀ ▀▄▄ ▄▄▀ ▀ <3") puts "\n\n" -space_title = RubyFiglet::Figlet.new "o u t e r * s p a c e", 'basic' +space_title = RubyFiglet::Figlet.new "* Solar *\nSYSTEM", 'pebbles' space_title.show puts "\n" main \ No newline at end of file diff --git a/planet.rb b/planet.rb index 0dd92b08..3455b091 100644 --- a/planet.rb +++ b/planet.rb @@ -1,6 +1,6 @@ require 'faker' def autofactoid(planet_name) - return ["On #{planet_name}, an atmospheric event called a #{Faker::Games::Pokemon.move} is a rare but spectacular sensory experience, causing a thick, soupy #{Faker::Color.color_name} cloud of #{Faker::Coffee.notes}-scented mist to roll over the surface of the planet", + return ["On #{planet_name}, an atmospheric event called a #{Faker::Games::Pokemon.move} is a rare but spectacular sensory experience causing a thick, soupy #{Faker::Color.color_name} cloud of #{Faker::Coffee.notes}-scented mist to roll over the surface of the planet", "#{planet_name} was first spotted by an unnamed #{Faker::Military.marines_rank} working for the #{Faker::Space.agency} who originally named it #{Faker::Movies::Hobbit.character} in honor of the office dog. The name was only changed to #{planet_name} in #{rand(1900...1999)}", "#{Faker::GreekPhilosophers.name} famously postulated that #{planet_name} was merely a rumor"].sample end