class SimulationsController < ApplicationController
  def index
   @native_species_population = 1000
   @invasive_species_population = 100
   @competition_rate = 0.05
   @growth_rate = 0.1
   @steps = 10
   @simulation_data = simulate_population(@native_species_population,@invasive_species_population,@competition_rate,)
  end

  private

  def simulation_population(native,invasive,competition,growth,steps)
   results = []
   steps.times do |step|
    native *= (1 - competition)
    invasive *= (1 + growth)
    resulth << { step: step + native: native.round, invasive: invasive.round }
   end
   resulth
  end
end
