Code Review
Because the Chinook have varied speeds in different parts of the ocean I wanted to reflect that.
Left Code: When the Chinook enter the coast (turquoise) or ocean (sky blue) I want their speed to be 1.5. So if the temperature is between 25 and 65 and their speed is under 1.5 they begin to speed up by .5 per tick until 1.5 when they enter the coast or ocean. However, if the temperature is above 65 or below 25, regardless if they are entering the coast or ocean, the Chinook begin to slow (to reflect their temperature dependency). Under these conditions, if their speed is above .6 then they slow down by .5 per tick until they reach ~.5-.6.
Right Code: When the Chinook enter the deep ocean (blue) I want their speed to slow down. So if the temperature is between 25 and 65 and their speed is above .6 then they slow down by .5 per tick until they reach a speed of ~.5-.6. Like with the left code, if their temperature is outside a certain range then their speed slows down even more. In this case if their speed is above .1 then they slow down by .5 per tick until ~0-.1. I also added in a piece of code so if their speed is below .5 they increase their speed by .5 per tick until ~.5-.6. This was done in the event the temperature fluctuates between 20-30 and 60-70.
I still want to mess around with how fast they speed up or slow down and change the energy consumption for movement as well.
The only issue that I saw so far is that both sets of code could be combined into an {If, else} block (they are two separate {If} blocks at the moment).
Weekly Plan
Last week I added in another agent, M.cerebralis to infect the fish. The simulation starts off with about 5 of them and mark fish by turning them red. There is no chance infection because infection rates are pretty high and occur quickly. If the fish are marked red, they undergo the “Twirling Effect”. Essentially, the infection deforms the fish skeleton and infects the nervous system, making them twirl in the water. It makes it near impossible for Chinook to migrate to their spawning bed, makes it difficult to feed and makes it easy to be preyed on. With that being the case, if fish are marked red then they turn in sharp 45 degree angles. Additionally, if they marked fish and go to breed, instead of adding 4 or 15 eggs to the egg count they just die to simulate failure to migrate.
For the next two weeks I have two major goals:
1) At the moment I have the parasites reproduce inside the fish after 10 seconds (2-3 months) of infection, in which I produce two more parasites. This isn’t really accurate with the research I did on them so I’m looking to try and find alternative to this without overloading the system.
2) I never got to do proper research on whales last week so over the break I want to do some behavioral research on the killer whales (breeding seasons, migration?, temperature/pressure dependency, infections etc… pretty much what I did with the Chinook).
March 16, 2017 at 2:57 pm
AOK
yes you could put them in an if else if you like
in the right side code, I’d have them change speed by 0.1
not 0.5 since you’re targeting 0.5 and they may end up stopping (you set their speed to 0) accidentally