NYT Number Play: Wolves and Sheep

NYT Number Play: Wolves and Sheep preview image

1 collaborator


(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.1 • Viewed 209 times • Downloaded 5 times • Run 0 times
Download the 'NYT Number Play: Wolves and Sheep' 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

Inspired by NYT Blog Column "Numberplay"


Posted about 3 years ago

Important notice: Applets are deprecated

Click to Run Model

breed [ wolves wolf ]
breed [ sheep a-sheep ]

to startup
  ask patches [ set pcolor grey + random-float 5 ]
  set-default-shape wolves "wolf"
  set-default-shape sheep "sheep"

to go
  create-wolves 5 [ oops_go_somewhere_new. ]
  create-sheep 3 [ oops_go_somewhere_new. ]
  while [ any? sheep with [ omg_danger_zone! ] ] [ ] ; plug 'til solved

to-report omg_danger_zone! ;; sheep procedure
    ask one-of ( list self STALKING_WOLVES ) [ ; be a bit smart and move offending animals
    report true ]
  report false

to-report STALKING_WOLVES ;; sheep procedure
  report wolves with [ xcor = [ xcor ] of myself 
                     or ycor = [ ycor ] of myself 
                     or abs( [ xcor ] of myself - xcor ) = abs ( [ ycor ] of myself - ycor ) ]

to oops_go_somewhere_new.
  move-to one-of patches with [ not any? other turtles-here ]

There are 2 versions of this model.

Uploaded by When Description Download
Michelle Wilkerson-Jerde about 3 years ago startup! Download this version
Michelle Wilkerson-Jerde about 3 years ago Initial upload Download this version

Attached files

File Type Description Last updated
NYT Number Play: Wolves and Sheep.png preview A solution over 2 years ago, by Michelle Wilkerson-Jerde Download

This model does not have any ancestors.

This model does not have any descendants.