Flapp' Shep

Flapp' Shep preview image

1 collaborator

B._knight B. Knight (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 6.1.1 • Viewed 94 times • Downloaded 18 times • Run 0 times
Download the 'Flapp' Shep' 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

globals [ max-sheep points gametick force alive pipeSliver pipey wolfPos]  ; don't let the sheep population grow too large

; Sheep and wolves are both breeds of turtles
breed [ sheep a-sheep ]  ; sheep is its own plural, so we use "a-sheep" as the singular
breed [ wolves wolf ]

turtles-own [ energy
flockmates         ;; agentset of nearby turtles
  nearest-neighbor   ;; closest one of our flockmates]       ; both wolves and sheep have energy
]

patches-own [ countdown ]    ; this is for the sheep-wolves-grass model version

to setup
  clear-all
  set points 0
  set force 1
  ;set spawnTime 70 * pipeSpeed
  set wolfPos 0.5
  set alive true
  ifelse netlogo-web? [ set max-sheep 10000 ] [ set max-sheep 30000 ]

  ; Check model-version switch
  ; if we're not modeling grass, then the sheep don't need to eat to survive
  ; otherwise each grass' state of growth and growing logic need to be set up


    ask patches [
      set pcolor brown
    if pycor < -13[
    set pcolor green
    ]
  ]
    if theme [
    ask patches [
        set pcolor blue
    if pycor < -13[
    set pcolor green
      ]
  ]
  ]

  create-sheep 1  ; create the sheep, then initialize their variables
  [
    set shape  "sheep"
    set color white
      if theme [
        set color yellow
      ]
    set size sheepSize  ; easier to see
    set label-color blue - 2
    setxy -4 0
  ]
    reset-ticks
end 

to go
  set gametick true

  if force < -1 * maxForce [
  set force -1 * maxForce
  ]
  if force > maxForce [
  set force maxForce
  ]

  ask sheep [
    if ycor < 16[
        set ycor (ycor + force)
      ]
    if ycor >= 15.2 [
      set ycor 15.2
    ]

   if pcolor = green[

      set force 0
      set gametick false
    ]

  ]
  if gametick = false [
    stop
  ]
  set force force - gravity


if alive [
    ask wolves[

        eatsheep

        fd pipeSpeed
        if xcor <= -16 [ die ]
    ]




if pipeSliver <= 5 [
      if ticks mod 2 = 0 [
      createTower
      set pipeSliver (1 + pipeSliver)
      ]
    ]

if ticks mod spawnTime = 0 and ticks > 1[
      set pipeSliver 0
      set pipey int -4 + random-float 15

    ]
if (ticks - 10) mod spawnTime = 0 and ticks > spawnTime [
      set points (points + 1)

  ]
]
  tick
end 

to eatSheep
let prey one-of sheep in-radius 2
  if prey != nobody[
    if alive = true [

   set alive false

     ]
    set force 1
  ]
end 

to createTower

  let tempY int 0

  ;;defining the amount of times sheep have been made
  if pipeSliver = 0 or pipeSliver = 5[ create-wolves 1
      [
        set shape "wolf"
        set color black
      if theme [
        set color green
        set shape "square"
      ]
        set heading 270
        set size 2  ; easier to see
        set label-color white - 2
        setxy (16) (pipey + 1 + tempY)
        fd wolfPos
      ]
    repeat pipeLength [
    set tempY (tempY + 1)
    ]
      create-wolves 1
      [
        set shape "wolf"
        set color black
      if theme [
        set color green
        set shape "square"
      ]
        set heading 270
        set size 2  ; easier to see
        set label-color white - 2
        setxy (16) (pipey + tempY)
        fd wolfPos
      ]
]



if pipeSliver > 0 and pipeSliver < 5 [
  repeat pipeLength [create-wolves 1  ; create the sheep, then initialize their variables
      [
        set shape "wolf"
        set color black
        if theme [
          set color green
          set shape "square"
        ]
        set heading 270
        set size 2  ; easier to see
        set label-color white - 2
        setxy (16) (pipey + tempY + 1)
        fd wolfPos
      ]
      set tempY (tempY + 1)
    ]

  ]
end 

to FLAP-YOUR-LITTLE-SHEEP-WINGS
  if alive [

  ask sheep [if ycor < 16 [
  set force jump-height
      ]
    ]
  ]
end 

  ;create-wolves initial-number-wolves  ; create the wolves, then initialize their variables
  ;[
  ;  set shape "wolf"
  ;  set color black
  ;  set size 2  ; easier to see
  ;  set energy random (2 * wolf-gain-from-food)
  ;  setxy random-xcor random-ycor
  ;]

There are 3 versions of this model.

Uploaded by When Description Download
B. Knight almost 5 years ago Added a little blurb of text Download this version
B. Knight almost 5 years ago Fixed the alt theme! Download this version
B. Knight almost 5 years ago Initial upload Download this version

Attached files

File Type Description Last updated
Flapp' Shep.png preview Preview for 'Flapp' Shep' almost 5 years ago, by B. Knight Download

This model does not have any ancestors.

This model does not have any descendants.