NETLOGO: Using variable from previous tick

前端 未结 1 1119
忘掉有多难
忘掉有多难 2021-01-23 23:43

is there some primitive for using value of variable from previous tick? I tried to compute variable of \"price\" for one agent and I mean to use formula which includes other age

相关标签:
1条回答
  • 2021-01-24 00:04

    No, there is no built-in way to do this in NetLogo. Your best bet would probably be to create a variable called something along the lines of varname-last-tick and then updating that as the last thing you do in the go procedure of these agents. It sounds like the variable you want to use for your agents is 'price', so it would be something like,

    to agent-go
      do-stuff
      set price-last-tick price
    end
    

    then you can use [price-last-tick] of other agents in your code rather than the current price.

    0 讨论(0)
提交回复
热议问题