Ian-Fogelman
Ian-Fogelman

Reputation: 1605

Check Neighbors Attribute

How can I reference the neighbor turtle in the following statement?

if count(turtles-on patch-ahead -1) with [(target-speed) > (target-speed)] > 0

I would like to compare the speed of the neighbor turtle to that of self.

Upvotes: 0

Views: 460

Answers (1)

mattsap
mattsap

Reputation: 3806

instead of count agentset > 0, try if any? agentset

You want to use [target-speed] of myself

So, to put it together.

if any? turtles-on patch-ahead -1 with [target-speed > [target-speed] of myself]

Upvotes: 1

Related Questions