Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Planet
- attr_reader :list_marker
- @@list_marker = []
- def initialize(name_planet)
- @name_planet = name_planet
- @list_marker = []
- end
- def list_marker
- @@list_marker
- end
- def find_sys(place)
- if place.location == @name_planet
- @@list_marker << place
- puts "our system"
- else
- puts "not our system"
- end
- end
- end
- class Map
- attr_accessor :location
- def initialize
- @long = 66
- @width = 33
- @location = 'moon'
- end
- end
- planet = Planet.new('moon')
- global_map = Map.new
- big_map = Map.new
- little_map = Map.new
- planet.find_sys(global_map)
- planet.find_sys(big_map)
- planet.find_sys(little_map)
- p planet.list_marker.map(&:location)
Advertisement
Add Comment
Please, Sign In to add comment