I am trying to produce a NetLogo model to simulate competition for wood fuel. The model consists of two turtle breeds: "households" and "trees" distributed randomly over the world. Households-own [ fuel-store target radius ]. When fuel-store = 0, households "find" a new tree within the minimum radius 1, increasing radius by 1 if there are no trees until the maximum radius is reached, using the following procedure:
to FindFuelGo
ask households [
if fuel-store = 0 [
set target min-one-of trees in-radius radius [ distance myself ]
if not any? trees in-radius radius [
if radius != max-radius [
set radius radius + 1
]
]
However as this model is simulating competition, how do I test whether a household shares the same target ( which it will inevitably will as the model runs) as another household, and if it does assign the target to whichever household has the shortest distance to the target? I have tried:
ask households [
let me self
let others other households
if target != nobody [
if [ target ] of me = [ target ] of others [
to first at least identify any households with the same variable however this doesn't work. Any thoughts would be greatly appreciated.