Roger
Roger

Reputation: 73

Netlogo: randomly transform breed

I'm working on a rebellion simulation and I'm trying to use Netlogo but I'm new to it so I'm running into some issues. I'm working off a modified wolf sheep model and I have three turtle types: police, rebels, and civilians. I have the general set up working but I'm trying to incorporate a civilian collateral damage element.

I want to model the police imperfectly differentiating rebels and civilians. When police mistakenly arrest a civilian, that causes n other number of random civilians to then become rebels. Where I get lost is interacting the police's actions with the civilian breed type. Below is my police procedure for civilian arrests:

to collateral-damage ;police procedure  
    let prey one-of civilians-here 
    if prey != nobody and random 100 < prob-collateral
    [ ask prey [ die ]  ] 

Any help is super appreciated!

Upvotes: 0

Views: 48

Answers (1)

JenB
JenB

Reputation: 17678

Breed can be set like any other turtle owned variable, with a set statement. There's not quite enough detail to give you a definitive answer, but I think you want something like:

let prey one-of civilians-here 
if prey != nobody and random 100 < prob-collateral
[ ask prey [set breed rebels]
  ask n-of min (list 5 count civilians) [set breed rebels]
]

Upvotes: 0

Related Questions