Agnes de Araujo
Agnes de Araujo

Reputation: 71

How I can count turtles with a certain variable in a patch with another variable?

I'm having troubles with my monitors. I want to count the total turtles with a certain variable in patches with another varible, but haven't been able to do it, all I got was erros. Here is what I have:

 patches-own [inovations?]
 turtles-own [income]

   count turtles with [income > 800] on patches with [inovations? = TRUE]

Thank you

Upvotes: 1

Views: 330

Answers (1)

Jasper
Jasper

Reputation: 2780

A turtle always has access to the variables of the patch which it is on. So you can just do:

count turtles with [income > 800 and inovations? = TRUE]

It's the same reason you can do things like ask turtles [ set pcolor red ] and count turtles with [ pxcor = max-pxcor ] even though pcolor and pxcor are patch variables.

Upvotes: 2

Related Questions