Communication-T-T Example

Communication-T-T Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner almost 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 796 times • Downloaded 87 times • Run 1 time
Download the 'Communication-T-T Example' 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

Click to Run Model

turtles-own [
  message?      ;; true or false: has this turtle gotten the message yet?
]

to setup
  clear-all
  crt 500 [
    set message? false
    setxy random-xcor random-ycor
  ]
  ask one-of turtles [ set message? true ]   ;; give the message to one of the turtles
  ask turtles [ recolor ]
  reset-ticks
end 

to go
  ask turtles [ move ]
  ask turtles [ communicate ]
  ask turtles [ recolor ]
  tick
end 

;; move randomly

to move  ;; turtle procedure
  fd random 4
  ;; turn a random amount between -40 and 40 degrees,
  ;; keeping the average turn at 0
  rt random 40
  lt random 40
end 

;; the core procedure!

to communicate  ;; turtle procedure
  if any? other turtles-here with [message?]
    [ set message? true ]
end 

; color turtles with message red, and those without message blue

to recolor  ;; turtle procedure
  ifelse message?
    [ set color red ]
    [ set color blue ]
end 


; Public Domain:
; To the extent possible under law, Uri Wilensky has waived all
; copyright and related or neighboring rights to this model.

There are 10 versions of this model.

Uploaded by When Description Download
Uri Wilensky over 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky about 12 years ago Updated version tag Download this version
Uri Wilensky almost 13 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky over 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky over 14 years ago Communication-T-T Example Download this version
Uri Wilensky over 14 years ago Communication-T-T Example Download this version

Attached files

File Type Description Last updated
Communication-T-T Example.png preview Preview for 'Communication-T-T Example' over 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.