Skip to content

Commit

Permalink
added logic to user list
Browse files Browse the repository at this point in the history
  • Loading branch information
sandy committed Feb 22, 2022
1 parent fdf5d9a commit ea3fda8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 27 deletions.
50 changes: 25 additions & 25 deletions main.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,26 @@
require_relative 'alien'
require_relative 'guest_list'
require_relative 'solar_system'
require 'colorize'
require 'lolize/auto'
puts ""

def main
earth = SolarSystem.new("Earth")
venus = SolarSystem.new("Venus")
mars = SolarSystem.new("Mars")
guest = SolarSystem.new("Guest List")

felines = Alien_Type.new('The Felines', 'gold, white, but it varies', 88973242, 'Sirius Star System', 'They exist from 3D on up to 12D!')
reptiles = Alien_Type.new('Reptiles', 'similar to human skin tone', 9, 'Pleiades Star Cluster', 'They communicate by means of light transfer.')
test_alien = Alien_Type.new('Test Alien', 'similar to human skin tone', 9, 'Pleiades Star Cluster', 'They communicate by means of light transfer.')
pleiadians = Alien_Type.new('Pleiadians', 'similar to human skin tone', 9, 'Pleiades Star Cluster', 'They communicate by means of light transfer.')
zetas = Alien_Type.new('Zetas', 'gray', 5.97324244, 'Reticuli binary star system', 'Zetas are intellectually ahead of us by a few million years or so.')

earth.add_alien(felines)
earth.add_alien(reptiles)
earth.add_alien(test_alien)

venus.add_alien(pleiadians)
mars.add_alien(zetas)
venus.add_alien(zetas)

exit_loop = false

Expand All @@ -35,29 +36,12 @@ def main

user_input = gets.chomp

if user_input == "list aliens"
puts ""
puts earth.list_aliens.colorize(:light_green)
puts venus.list_aliens.colorize(:light_magenta)
puts mars.list_aliens.colorize(:light_red)
puts guest.list_user_aliens.colorize(:light_cyan)
if user_input == "list aliens"
puts ""
end

def new_guest_alien
puts earth.list_aliens
puts venus.list_aliens
puts guest.list_user_aliens
puts ""
puts "Let's add a new alien! Please provide the following info:"
puts ""
print "Alien name: "
name = gets.chomp

brand_new_alien = Guest_Type.new(name)
return brand_new_alien
end

if user_input == "add an alien"
brand_new_alien = new_guest_alien
guest.user_added_alien(brand_new_alien)
end

if user_input == "read alien details"
Expand All @@ -70,14 +54,30 @@ def new_guest_alien
found_alien = venus.find_alien_by_name(search)
found_alien = mars.find_alien_by_name(search)
if (found_alien)
puts found_alien.summary.colorize(:yellow)
puts found_alien.summary
puts ""
else
puts "Sorry that alien is not in our list, please add them if you wish!"
puts ""
end
end

def new_guest_alien
puts ""
puts "Let's add a new alien! Please provide the following info:"
puts ""
print "Alien name: "
name = gets.chomp

brand_new_alien = Guest_Type.new(name)
return brand_new_alien
end

if user_input == "add an alien"
brand_new_alien = new_guest_alien
guest.user_added_alien(brand_new_alien)
end

if user_input == "exit"
exit_loop = true
end
Expand Down
3 changes: 1 addition & 2 deletions solar_system.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ def find_alien_by_name(search)
return found_alien
end


def list_aliens
puts
alien_list = "Alien races living on #{@p_name}"
Expand All @@ -43,7 +42,7 @@ def list_user_aliens
@user_types.each_with_index do |alien, index|
alien_user_list+= "\n #{index+1}: #{alien.name}"
end
return alien_user_list
return alien_user_list if @user_types.count > 0
end
end

0 comments on commit ea3fda8

Please sign in to comment.