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

Comments and Questions

Inspired by NYT Blog Column "Numberplay"

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

Posted 9 months ago

Click to Run Model

## WHAT IS IT?

(a general understanding of what the model is trying to show or explain)

## HOW IT WORKS

(what rules the agents use to create the overall behavior of the model)

## HOW TO USE IT

(how to use the model, including a description of each of the items in the Interface tab)

## THINGS TO NOTICE

(suggested things for the user to notice while running the model)

## THINGS TO TRY

(suggested things for the user to try to do (move sliders, switches, etc.) with the model)

## EXTENDING THE MODEL

(suggested things to add or change in the Code tab to make the model more complicated, detailed, accurate, etc.)

## NETLOGO FEATURES

(interesting or unusual features of NetLogo that the model uses, particularly in the Code tab; or where workarounds were needed for missing features)

## RELATED MODELS

(models in the NetLogo Models Library and elsewhere which are of related interest)

## CREDITS AND REFERENCES

(a reference to the model's URL on the web if it has one, as well as any other necessary credits, citations, and links)

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 9 months ago startup! Download this version
Michelle Wilkerson-Jerde 9 months ago Initial upload Download this version

Attached files

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

This model does not have any ancestors.

This model does not have any descendants.