I'm trying to set up a toy model of connected turtles. Every turtle has a random belief [0,1] and I want to implement some conditions:
- If it's a turtle with belief > .5 the turtle doesn't do anything.
- If it's a turtle with belief < .5 and one of their immediate neighbour has a belief > .5, their new belief (of the turtle with belief < .5) would be belief + .1.
- If the turtle with belief < .5 doesn't have an immediate neighbour with belief > .5, the turtle doesn't do anything.
The basic setup:
turtles-own [belief]
to setup
ca
reset-ticks
crt 5 [
set shape "person"
layout-circle turtles 5
set belief random-float 1
]
ask turtles [ create-links-with min-n-of 2 other turtles [distance myself] ]
end
This creates a 5 turtles cycle network. Now they have to check the beliefs of their (two) closest neighbors. I tried this:
to go
ask turtles with [one-of link-neighbors with [belief > .5]] [
set belief belief + .1
]
end
So the basic idea is that every turtle with a connected neighbour with belief > .5 has to add .1 to its own belief. I have tried several variations of the ask turtles with line, but it always shows me a runtime error of this sort: WITH expected a true/false value from (turtle 0), but got (turtle 2) instead. Any ideas? Thank you in advance.