Indicriminete Violence & Intelligence

No preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 47 times • Downloaded 3 times • Run 0 times
Download the 'Indicriminete Violence & Intelligence' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)


Info tab cannot be displayed because of an encoding error

Comments and Questions

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [villagers villager]
breed [soldiers soldier]
breed [rebels rebel]
breed [unfits unfit]
breed [deads dead]




globals [ ;; Global variables.
  total-villager
  total-soldier
  total-rebel
  total-unfit
  total-dead
]



turtles-own[  ;; Turtle variables.
  turn-check
  wall-turn-check
  age
]
soldiers-own[
  intelligence
]

deads-own[
  count-down]

to setup
  set-default-shape villagers "person business"
  set-default-shape soldiers "person police"
  set-default-shape rebels "person soldier"
  set-default-shape unfits "person student"
  set-default-shape deads "person"
  clear-all
  reset-ticks

  ask patches [set pcolor grey - 3]

  create-villagers CIV [
    set color grey
    setxy random-xcor random-ycor
    set age (random 101) / UNF
    if age < 1 [set breed unfits set color pink - 1]
  ]


  create-soldiers COIN [
    set color brown + 3
    setxy random-xcor random-ycor
    set age -2
    set intelligence random 101
  ]


  create-rebels INS [
    set color brown + 2
  setxy random-xcor random-ycor
    set age (random 101)
  ]

  ask turtles [set size 0.5]
end 

to go              ;; the fun beginns

  tick
  update-globals
  do-plots
  set-default-shape villagers "person business"
  set-default-shape soldiers "person police"
  set-default-shape rebels "person soldier"
  set-default-shape unfits "person student"
  set-default-shape deads "person"



  ask villagers [
  forward 0.2
    wander
    let current-villager self
   let persuade  random count villagers + random 1000
    if persuade <  random count deads [ask rebels with [distance current-villager < 1] [soothe]]
  ]


  ask soldiers
  [
    wander
    forward 0.1
    let current-soldier self
    let attack random 101
    if attack < 80 [ask rebels with [distance current-soldier < 1] [kill]]

    if any? deads in-radius .5
      [intdown]
    if any? rebels in-radius 1
    [set intelligence intelligence + 10]

    interact

    if intelligence > 90 [ask unfits with [distance current-soldier < .1] [kill]]
    if intelligence > 80 and intelligence < 90 [ask unfits with [distance current-soldier < .2] [kill]]
    if intelligence > 70 and intelligence < 80 [ask unfits with [distance current-soldier < .3] [kill]]
    if intelligence > 60 and intelligence < 70 [ask unfits with [distance current-soldier < .4] [kill]]
    if intelligence > 50 and intelligence < 60 [ask unfits with [distance current-soldier < .5] [kill]]
    if intelligence > 40 and intelligence < 50 [ask unfits with [distance current-soldier < .6] [kill]]
    if intelligence > 30 and intelligence < 40 [ask unfits with [distance current-soldier < .7] [kill]]
    if intelligence > 20 and intelligence < 30 [ask unfits with [distance current-soldier < .8] [kill]]
    if intelligence > 10 and intelligence < 20 [ask unfits with [distance current-soldier < .9] [kill]]
    if intelligence > 0 and intelligence < 10 [ask unfits with [distance current-soldier < 1] [kill]]
    if intelligence > 90 [ask unfits with [distance current-soldier < .1] [kill]]
    if intelligence > 80 and intelligence < 90 [ask villagers with [distance current-soldier < .2] [kill]]
    if intelligence > 70 and intelligence < 80 [ask villagers with [distance current-soldier < .3] [kill]]
    if intelligence > 60 and intelligence < 70 [ask villagers with [distance current-soldier < .4] [kill]]
    if intelligence > 50 and intelligence < 60 [ask villagers with [distance current-soldier < .5] [kill]]
    if intelligence > 40 and intelligence < 50 [ask villagers with [distance current-soldier < .6] [kill]]
    if intelligence > 30 and intelligence < 40 [ask villagers with [distance current-soldier < .7] [kill]]
    if intelligence > 20 and intelligence < 30 [ask villagers with [distance current-soldier < .8] [kill]]
    if intelligence > 10 and intelligence < 20 [ask villagers with [distance current-soldier < .9] [kill]]
    if intelligence < 10 [ask villagers with [distance current-soldier < 1] [kill]]
    ;;if any? villagers in-radius (intelligence ^ -1 + .5) [ask unfits in-radius 1 [kill]]
  ]


  ask rebels [
    forward 0.2
    wander
    let current-rebel self
    let persuade random count rebels + random 1000
    if persuade < random count villagers [ask villagers with [distance current-rebel < (1 + count deads)] [radicalize]]
    let attack random 100
    if attack < 5 [ask soldiers with [distance current-rebel < 1] [kill]]
  ]

  ask unfits [
    wander
    fd 0.2
]



 ;;ask deads [                           ;;meet your ancestors
   ;;decrement-timer
  ;;if count-down  < -2 [die]
  ;;]

  if (count rebels = 0) [stop]
  if (count soldiers = 0) [stop]
end 


;; definitions

to decrement-timer
  set count-down count-down - 1
end 

to intdown
  let current-soldier self
  ask current-soldier [set intelligence intelligence - 6]
  carefully [ask  up-to-n-of random 2 villagers [radicalize]] [print error-message]
end 

to interact
 if any? villagers in-radius 1 [intup]
 if any? unfits in-radius 1 [intup]
end 

to intup
  let current-soldier self
  ask current-soldier [set intelligence intelligence + 3]
end 

to soothe
  set breed villagers
  set color grey
end 

to radicalize
  set breed rebels
  set color brown + 1
end 

to kill
  set breed deads
  set color black
  set age -2
end 

to wander                 ;; Random movement for agents.
  set turn-check random 20
  if turn-check > 15
  [right-turn]
  if turn-check < 5
  [left-turn]
  ;if [pcolor] of patch-ahead 1 = green
 ; [wall]
end 

;to wall ;;  Turn agent away from wall
 ;   set wall-turn-check random 10
  ;  if wall-turn-check >= 6
   ; [wall-right-turn]
    ;if wall-turn-check <= 5
    ;[wall-left-turn]
;end

to wall-right-turn ;;Generate a random degree of turn for the wall sub-routine.
  rt 170
end 

to wall-left-turn ;;Generate a random degree of turn for the wall sub-routine.
  lt 170
end 

to right-turn ;;Generate a random degree of turn for the wander sub-routine.
  rt random-float 10
end 

to left-turn   ;;Generate a random degree of turn for the wander sub-routine.
  lt random-float 10
end 

to update-globals ;;Set globals to current values for reporters.
  set total-rebel (count rebels)
  set total-soldier (count soldiers)
  set total-villager (count villagers)
  set total-unfit (count unfits)
  set total-dead (count deads)
end 

to do-plots                ;; Update monitors
  set-current-plot "#1"
  set-current-plot-pen "Insurgents" plot total-rebel
  set-current-plot-pen "COIN" plot total-soldier
  set-current-plot-pen "Civilians" plot total-villager
  set-current-plot-pen "Dead" plot total-dead
  set-current-plot "Unfit for Battle"
  set-current-plot-pen "Unfits" plot total-unfit
end 

There are 2 versions of this model.

Uploaded by When Description Download
Stefan Baumgartner 2 months ago Fixed some bugs and introduced more bugs to fix later Download this version
Stefan Baumgartner 3 months ago Adaption to take intelligence into account [inflammatory model] Download this version

Attached files

File Type Description Last updated
hearts and minds.jpg jpeg 1 3 months ago, by Stefan Baumgartner Download

Parent: indiscriminate violence| suppressive model

This model does not have any descendants.

Graph of models related to 'Indicriminete Violence & Intelligence'