4

I have an agentset named giant-component, and I set all the agents' color to red:

ask giant-component [
    set color red
    ask my-links [
      set color red
    ]
  ]

Now I need to set all other turtles' color to blue. I know that the easy trick would be to first set all turtles' color to blue, and then colour all the giant component to red, but during the simulation it may get confusing for the user to see it. Is there a way to get all the turtles that are not inside giant-component?

Ramy Al Zuhouri
  • 21,580
  • 26
  • 105
  • 187
  • If you use tick-based updates, as every NetLogo model should, then the user won't ever see turtles being temporarily blue, because the view won't update until the tick ends. See http://ccl.northwestern.edu/netlogo/docs/programming.html#updates – Seth Tisue Jun 21 '15 at 12:39

2 Answers2

4

The answer above solves your problem of colouring. A more general answer that may be useful for other visitors to this question:

let not-giant turtles with [not member? self giant-component]

This creates the agentset of turtles who are not in the giant-component agentset

JenB
  • 17,620
  • 2
  • 17
  • 45
0

if it's true that the only turtles with color = red are the ones in your agent-set, you can set the color of all the other turtles like this:

ask turtles with [color != red] [set color blue]

edit

sorry i didn't read well the first line of the question.

I would do this in two ways:

1- set a turtle own to all turtles to true if they belong to the agent-set and then

ask turtles with [your-property = false][set color blue]

2- define two kinds of breed: one for the turtles in your agentset (let's say breed-in), the other for the turtles outside your agentset (let's say breed-out). Now you can just say:

ask breed-out [set color blue]
drstein
  • 1,113
  • 1
  • 10
  • 24