I have a model of tax evasion where the taxes should be payed each round, e.g. each 1000 ticks. As a placeholder, I have this code
ask traders with [ticks = 1000 or ticks = 2000 or ticks = 3000];; Can this be set using a seed?
[reset-parameters
pay-taxes
revise-behavior
reset-turnover]
In SQL, I would have set done something like this:
FOR I IN 1..3000 LOOP ask traders with ticks = I*1000
Is there a similar function in Netlogo? Any other tips on how to make something happen every 1000 ticks?
Your own solution will work, but is not optimal.
Since ticks
is a global NetLogo reporter, and not a traders
variable, the value returned by ticks mod 1000 = 0
does not vary with each trader. It will either be true
for all of them or false
for all of them, so there is no use putting in in a with
clause (where it will be re-evaluated for each trader).
It would be faster (and clearer) to just do:
if ticks mod 1000 = 0 [
ask traders [
do-something
]
]
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With