Random Messenger Turtles

Random Messenger Turtles preview image

1 collaborator

Ahnaf_tahmid Ahnaf Tahmid (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 42 times • Downloaded 7 times • Run 0 times
Download the 'Random Messenger Turtles' 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

turtles-own [message?] ; true or false? does a turtle own a message?

to setup ; in order to setup a new model, do the following
  clear-all
  reset-ticks
  create-turtles 75 ; create 75 turtles
  [
    set message? false ; nobody has a message
    setxy random-xcor random-ycor ; spread turtles on random x&y coordinates
  ]
  ask turtles
  [
    set shape "turtle" ; check out others under tools > Turtle shape editor
    set size 3
    set color red ; try different colors
  ]
  ask one-of turtles [set message? true] ; give one of the turtles a message
end 

to go ; in roder to go
  ask turtles
  [
    ifelse coin-flip? [right random 60] [left random 60]
    ; if coin-flip is true (0) then turn right up to 60 degrees, otherwise (else) left
    forward random 4 ; move randomly between 0 and 3 steps forward

    ; if the turtle meets another turtle at the same patch, then communicate the message
    if any? other turtles-here with [message?] ; if another turtle is at the same patch
    [set message? true] ; communicate the message
    if message? [set color yellow] ; make all carriers of message yellow
  ]
  tick ; add one unit of time to our counter
end 

to-report coin-flip?
  report random 2 = 0
end 

There is only one version of this model, created over 3 years ago by Ahnaf Tahmid.

Attached files

File Type Description Last updated
Random Messenger Turtles.png preview Preview for 'Random Messenger Turtles' over 3 years ago, by Ahnaf Tahmid Download

This model does not have any ancestors.

This model does not have any descendants.