No preview image

3 collaborators

Default-person Nicholas Novack (Author)
Default-person milla rose (Advisor)
Default-person Leander Schatz (Advisor)


(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.1.1 • Viewed 27 times • Downloaded 3 times • Run 0 times
Download the 'MIHS-20_Period4_NickN_LeanderS_MillaL_CaitlinR' 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

Please start the discussion about this model! (You'll first need to log in.)

Click to Run Model

breed [sheep a-sheep]
breed [cows cow]
turtles-own [ energy ]  ;; agents own energy

patches-own [ grass-amount ]  ;; patches have grass

;; this procedures sets up the model

to setup
  ask patches [
    ;; give grass to the patches, color it shades of green
    set grass-amount random-float 10.0
    recolor-grass ;; change the world green
  create-sheep number-of-sheep [
    setxy random-xcor random-ycor
    set color white
    set shape "sheep"
    set energy 100
    create-cows number-of-cows [
    setxy random-xcor random-ycor
    set color brown
    set shape "cow"
    set energy 100

;; make the model run

to go
  if not any? turtles [
  ask turtles [
    wiggle        ;; first turn a little bit
    move          ;; then step forward
    check-if-dead ;; check to see if agent should die
    eat           ;; sheep eat grass
    reproduce     ;; the sheep reproduce
  regrow-grass    ;; the grass grows back
  my-update-plots ;; plot the population counts

;; check to see if this sheep has enough energy to reproduce

to reproduce
  if energy > 200 [
    set energy energy - 100  ;; reproduction transfers energy
    hatch 1 [ set energy 100 ] ;; to the new agent

;; recolor the grass to indicate how much has been eaten

to recolor-grass
  set pcolor scale-color green grass-amount 0 20

;; regrow the grass

to regrow-grass
  ask patches [
    set grass-amount grass-amount + grass-regrowth-rate
    if grass-amount > 10.0 [
      set grass-amount 10.0

;; sheep procedure, sheep eat grass

to eat
  ;; check to make sure there is grass here
  if ( grass-amount >= energy-gain-from-grass ) [
    ;; increment the sheep's energy
    set energy energy + energy-gain-from-grass
    ;; decrement the grass
    set grass-amount grass-amount - energy-gain-from-grass

;; asks those sheep with no energy to die

to check-if-dead
  if energy < 0  [

;; update the plots in the interface tab

to my-update-plots
  plot count sheep
  plot count cows

;; sheep procedure, the sheep changes its heading

to wiggle
  ;; turn right then left, so the average is straight ahead
  rt random 90
  lt random 90

;; sheep procedure, the sheep moves which costs it energy

to move
  forward 1
  set energy energy - movement-cost ;; reduce the energy by the cost of movement

; Copyright 2007 Uri Wilensky.
; See Info tab for full copyright and license.

There is only one version of this model, created 4 months ago by Nicholas Novack.

Attached files

No files

This model does not have any ancestors.

This model does not have any descendants.