Reputation: 337
In NetLogo, suppose there are two kinds (breeds) of turtles: AAA and BBB.
breed [ AAA ]
breed [ BBB ]
AAA-own [ vvv ]
BBB-own [ vvv ]
Suppose I am iterating over AAA, and when an AAA finds a BBB nearby, it steals 10% of vvv
from the BBB individual. If there is a global variable called dummy
, the following code may work:
to function-name
let QQQ one-of BBB in-radius 1
ask QQQ [
set dummy vvv * 0.1
set vvv vvv - dummy
]
set vvv vvv + dummy
end
Is there any way to do the similar thing without using the global variable, dummy
?
Upvotes: 1
Views: 295