# Nathan Hinton 1 Oct 2025 PLANET_PRODUCTION_RESOURCES = [:ships] # This class holds information about a planet. class Planet attr_reader :owner # Create a planet # # @param random [Random] The random generator for the game (ensures seeds can be duplicated) def initialize(random) @random = random @prod_rate = @random.rand @resource = PLANET_PRODUCTION_RESOURCES.sample(random: @random) @owner = nil end # Change the ownership of a planet. Should check for things like the planet # has no defenders left and other fun stuff (later) # # @param owner [Player] The owner of the planet # @return [Boolean] If the operation was successful or not def change_owner(owner) # For now only unclaimed planets can be owned if @owner.nil? @owner = owner return true end return false end end