NYT Number Play: Wolves and Sheep

NYT Number Play: Wolves and Sheep preview image

1 collaborator

Tags

(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 167 times • Downloaded 4 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"

http://wordplay.blogs.nytimes.com/2012/08/13/numberplay-wolves/?src=recg

Posted about 2 years ago

Important notice: Applets are deprecated

Click to Run Model

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

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

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
end 

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

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 ) ]
end 

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

There are 2 versions of this model.

Uploaded by When Description Download
Michelle Wilkerson-Jerde about 2 years ago startup! Download this version
Michelle Wilkerson-Jerde about 2 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 1 year ago, by Michelle Wilkerson-Jerde Download

This model does not have any ancestors.

This model does not have any descendants.