Agents-Netlogo

11 views
Skip to first unread message

Batul Mohsina

unread,
Nov 2, 2022, 1:03:27 PM11/2/22
to netlogo-users
I need help in giving a condition for turtles to turn orange if there is a red turtle in its radius

Michael Tamillow

unread,
Nov 2, 2022, 1:56:14 PM11/2/22
to Batul Mohsina, netlogo-users
This is the function:


You will probably need to use “myself” to point back to the original turtle as well.


Maybe post a reply with the code you attempted to write after reviewing the documentation if it still doesn’t work and I will help you troubleshoot it.

Sent from my iPhone

On Nov 2, 2022, at 12:03 PM, Batul Mohsina <batul.m...@gmail.com> wrote:

I need help in giving a condition for turtles to turn orange if there is a red turtle in its radius

--
You received this message because you are subscribed to the Google Groups "netlogo-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netlogo-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netlogo-users/1a9da19d-4b24-4f5a-a2b7-cbb43be288c1n%40googlegroups.com.

Stephen Guerin

unread,
Nov 3, 2022, 3:56:40 PM11/3/22
to Batul Mohsina, netlogo-users
If the red turtles will also switch to orange, as they are within radius of themselves, you will need to do this in two steps so all turtles have a chance to see a red turtle before it switches to orange. Ie, collect all the "candidates" in one step and then switch their colors:

  let candidates turtles with [any? turtles in-radius 3 with [color = red] ]
  ask candidates [set color "orange"]

Stephen

--- -. .   ..-. .. ... ....   - .-- ---   ..-. .. ... ....
Stephen...@Redfish.com
1600 Lena St #D1, Santa Fe, NM 87505
office: (505) 995-0206  mobile: (505) 577-5828   
tw: @redfishgroup  skype: redfishgroup
zoom.redfish.com


On Tue, Nov 1, 2022 at 11:31 PM Batul Mohsina <batul.m...@gmail.com> wrote:
I need help in giving a condition for turtles to turn orange if there is a red turtle in its radius

--
Reply all
Reply to author
Forward
0 new messages