Breed Procedures Example

Breed Procedures Example preview image

1 collaborator

Uri_dolphin3 Uri Wilensky (Author)

Tags

code example 

Tagged by Reuven M. Lerner about 11 years ago

netlogo 

Tagged by Tim Denton about 12 years ago

Model group CCL | Visible to everyone | Changeable by group members (CCL)
Model was written in NetLogo 5.0.4 • Viewed 650 times • Downloaded 72 times • Run 2 times
Download the 'Breed Procedures 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

breed [dogs dog]
breed [cats cat]
breed [cows cow]

to setup
  clear-all
  set-default-shape dogs "dog"
  set-default-shape cats "cat"
  set-default-shape cows "cow"
  ask patch 0  1 [ sprout-dogs 1 ]
  ask patch 0  0 [ sprout-cats 1 ]
  ask patch 0 -1 [ sprout-cows 1 ]
end 

to go
  ;; "turtles" refers to all of the turtles,
  ;; no matter what breed they are
  ask turtles [
    ;; each turtle takes its breed, adds "-speak"
    ;; onto it, and then runs that procedure
    run word breed "-speak"
  ]
end 

;; Here we have the separate procedure definitions
;; for each breed.

to dogs-speak  ;; dog procedure
  set label "arf arf!"
end 

to cats-speak  ;; cat procedure
  set label "meow!"
end 

to cows-speak  ;; cow procedure
  set label "mooooo!"
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 almost 11 years ago Updated to NetLogo 5.0.4 Download this version
Uri Wilensky over 11 years ago Updated version tag Download this version
Uri Wilensky about 12 years ago Updated to NetLogo 5.0 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Updated from NetLogo 4.1 Download this version
Uri Wilensky almost 14 years ago Model from NetLogo distribution Download this version
Uri Wilensky almost 14 years ago Breed Procedures Example Download this version
Uri Wilensky almost 14 years ago Breed Procedures Example Download this version

Attached files

File Type Description Last updated
Breed Procedures Example.png preview Preview for 'Breed Procedures Example' almost 11 years ago, by Uri Wilensky Download

This model does not have any ancestors.

This model does not have any descendants.