Netlogo: to spread fear (change color and speed)

298 views Asked by At

I have n-of turtles panic at the beginning of the simulation. to panic means to set fear? true, set color red and the speed is supposed to be 2 instad of 1. Those n-of turtles are supposed to spread their fear. Now I have two problems:

  • panicking turtles do not move faster than normal turtles

I tried turtles-own [speed] and set speed speed + 2 for the panicking turtles (while fear? = true), but it doesn't work.

  • panicking turtles won't spread their fear

I have the following code:

to panic
  set color red
  set speed speed + 2
  set fear? true
end

to fear
  ask n-of number-of-panicking-people turtles [panic]
end 

to spread
  ask turtles with [fear? = true and color != red]
  [ask other turtles-here with [fear? = false]
    [if (random-float 100) < spreadfear
      [panic]]]
end

The only thing that works so far is "to fear", where some turtles become red but the speed doesn't change etc.

Thank you!

0

There are 0 answers