I am writing a model where farmers update profits seasonally and cultivate crops accordingly. In total there will 630 ticks in a year's time period.There are two seasons. First season will take 252 ticks to complete a crop cycle. And other season will take next 378 ticks to complete a crop cycle. For both seasons farmer will calculate her profits. Initially after 252 ticks and then reset some of the variables to start for next season and calculate profits for next 378 ticks. This will go on simultaneously and run for the period of time let's say 10 years or more. Is there anyone who can help in writing the codes.
Below codes are given.
Problem: Ticks mod command will overcalculate or under calculate profits for every season. I want to calculate profits for season 1 from 0 to 252 ticks for season2 from 253 ticks to 630. and again for season1 from 631 to 882 and again for sesson2 till 1260 ticks. adn this will continue.
breed [farmers farmer]
farmers-own [water irrigation-turn]
to setup
clear-all
create-farmers 5
[ set label who
set size 2
]
ask farmer 0 [ setxy min-pxcor + 1 0 set irrigation-turn 0]
ask farmer 1 [ setxy min-pxcor + 1 2 set irrigation-turn 1]
ask farmer 2 [ setxy min-pxcor + 1 4 set irrigation-turn 2]
ask farmer 3 [ setxy min-pxcor + 3 0 set irrigation-turn 3]
ask farmer 4[ setxy min-pxcor + 3 2 set irrigation-turn 4]
ask farmers [ set label who
set size 2]
reset-ticks
end
to go
irrigate
update-profits
tick
end
to irrigate
ask turtles with [irrigation-turn = (ticks mod count farmers)]
[ set color red]
ask turtles with [ irrigation-turn != (ticks mod count farmers)]
[set color blue]
end
to update-profits
if ticks mod 630 = 252 [set-season1profit]
if ticks mod 630 = 378 [ set-season2profits]
end