thief and cops

thief and cops preview image

1 collaborator

Default-person gioele de felice (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.2.2 • Viewed 62 times • Downloaded 5 times • Run 0 times
Download the 'thief and cops' modelDownload this modelEmbed this model

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


Comments and Questions

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

Click to Run Model

breed[guardie guardia]
breed[ladri ladro]
breed[facce faccia]

globals [ n_ladri]

to setup
  clear-all
  reset-ticks
  crea_guardie
  crea_ladri
  crea_faccia
  set-default-shape turtles "circle"
end 

to go
  if ticks = 1000 [ ask facce [set color [255 255 255 ] ]  ]
  ask guardie [muovi_tipo_1 pen-down acchiappa]
  ask ladri [muovi_tipo_2]
  conta
  if n_ladri = 0 [stop]
 tick
end 

to muovi_tipo_1
  rt random 30 lt random 30 fd 1
end 

to muovi_tipo_2
  rt random angolo lt random angolo fd 1
end 

to crea_tartarughe
    create-turtles n_tartarughe[
    setxy random-xcor random-ycor
    set color [0 255 255]
    set size 1.5
    set shape "default"
  ]
end 

to crea_guardie
    create-guardie 10 [
    setxy random-xcor random-ycor
    set color [0 0 255]
    set size 2
    set shape "circle"
  ]
end 

to crea_ladri
    create-ladri random n_tartarughe [
    setxy random-xcor random-ycor
    set color [255 0 0]
    set size 1.5
    set shape "default"
  ]
end 

to crea_faccia
    create-facce 1 [
    setxy random-xcor random-ycor
    set color [0 255 0]
    set size 2
    set shape "face happy"
  ]
end 

to conta
set n_ladri   count ladri
end 

to acchiappa
  let sfortunato one-of ladri in-radius 1
 if sfortunato != nobody  [
    ask sfortunato [ die ]
   ]
end 

There is only one version of this model, created about 2 years ago by gioele de felice.

Attached files

File Type Description Last updated
thief and cops.png preview Preview for 'thief and cops' about 2 years ago, by gioele de felice Download

This model does not have any ancestors.

This model does not have any descendants.