Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Netlogo ...compare a a turtle variable to patch variable on which it is standing

Tags:

netlogo

I would like to compare a turtle variable with the patch variable on which it is standing.

 ask  patches with [ pcolor = green and inventory > 0]

[ ask one-of turtles-here [if myself [ conviction] > detection )

Conviction is a turtle variable and detection is a patch variable. Can it be done. This is my first posting. So apologies if the format is not correct.

like image 630
Shawkat Avatar asked Jul 10 '26 19:07

Shawkat


1 Answers

A turtles has direct access to the variables of the patch under it:

turtles-own [ conviction ]
patches-own [ detection ]

to go
  ask patches [
    ask one-of turtles-here [
      if conviction > detection [ ; the turtle accesses both variables directly
        ; do something
      ]
    ]
  ]
end
like image 150
Nicolas Payette Avatar answered Jul 14 '26 05:07

Nicolas Payette



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!