Darwinbots Forum

Code center => Suggestions => Topic started by: spork22 on July 12, 2014, 02:55:55 PM

Title: Weather
Post by: spork22 on July 12, 2014, 02:55:55 PM
Perhaps there could be an option that when activated makes the sun turn on and off randomly in no predetermined order. Because of the random times of darkness, plants wouldn't get their energy as much. This would discourage zerobots to evolve chloroplasts, as they aren't a constant source of energy anymore.
Title: Re: Weather
Post by: Botsareus on July 12, 2014, 07:13:30 PM
I will add an option to randomize the 'sun on' time.
Title: Re: Weather
Post by: Panda on July 13, 2014, 12:47:39 PM
That's a good idea. Rather than just on or off, do you think an intensity modifier would be good?
Title: Re: Weather
Post by: Botsareus on July 13, 2014, 12:52:00 PM
Here is what I was thinking.
Put a very simple boolean in, call it "sunonrnd"
The code mod is as follows:

If SimOpts.DayNight And Not OverrideDayNight Then
      'Well, we are neither above nor below the thresholds or we arn't using thresholds so lets see if it's time to rise and shine
      SimOpts.DayNightCycleCounter = SimOpts.DayNightCycleCounter + 1
      If SimOpts.DayNightCycleCounter > SimOpts.CycleLength Then
        SimOpts.Daytime = Not SimOpts.Daytime
        SimOpts.DayNightCycleCounter = IIF(sunonrnd, SimOpts.CycleLength * rnd, 0)
      End If
      If SimOpts.Daytime Then
        FeedThisCycle = True
      Else
        FeedThisCycle = False
      End If
  End If

And that is the least pain in the a** way to implement this thing.
edit: I am thinking just mod it further to randomize only the 'on' cycles while leaving the 'off' cycles at 0.
Title: Re: Weather
Post by: spork22 on July 13, 2014, 04:10:11 PM
I'm glad you guys like my idea.  :D