Gatherer Model v2

No preview image

1 collaborator

Default-person Audrey Hosford (Author)


(This model has yet to be categorized with any tags)
Part of project 'Hunter-Gatherer Final Project' Parent of 1 model: Gatherer Model v3
Model group MAM-2013 | Visible to everyone | Changeable by everyone
Model was written in NetLogo 5.0.4 • Viewed 310 times • Downloaded 30 times • Run 0 times
Download the 'Gatherer Model v2' modelDownload this modelEmbed this model

Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)

Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

breed [hunters hunter]
breed [gatherers gatherer]
breed [rabbits rabbit]

hunters-own [ energy
             has-rabbit? ]
gatherers-own [has-food?
             energy ]
rabbits-own [ energy ]

to setup
  set-default-shape hunters "person" ;; create hunters
  set-default-shape gatherers "person" ;; create hunters
  set-default-shape rabbits "rabbit"
  ask patches
  [ ifelse random-float 100 < density 
    [set pcolor yellow] ;; scatter food
    [set pcolor green] ]
  create-hunters number [
    set color red
    set size 5
    set energy 100
    setxy random-xcor random-ycor
    set patience 100
    set has-rabbit? false
  create-gatherers number2 [
    set color white
    set size 5
    set energy 100
    setxy random-xcor random-ycor
    set has-food? false
  create-rabbits number3 [
    set color brown
    set size 3
    set energy 50
    setxy random-xcor random-ycor

to go
  ;; AH: Adding correct indentation here makes it a lot easier to read and code. Just highlight and press tab. :)

  ask turtles [
    ask gatherers with [not has-food?] [find-food]
    ask gatherers with [has-food?] [find-pile]
    ask gatherers with [not has-food?] [
      if energy < 70 [eat-food]]
    ask hunters with [not has-rabbit?] [hunt-rabbits]
    ask hunters with [has-rabbit? and energy < 70] [eat-rabbit]
    if ticks mod 500 = 0 [set energy (energy - 5)]
    ask rabbits [reproduce-rabbits]
    ask rabbits with [energy < 40] [rabbit-eat]
    ask turtles with [energy <= 0] [die]

;; We move in a separate procedure

to move 
  fd 1
  rt 20 - random 40

;; You call this procedure recursively and move around, instead of moving around for each tick, and then calling this
;; procedure.

to find-food
    ;; we pick up food only if there is not already a lot of food around it
    ;; (i.e. on at least three patches)
    if pcolor = yellow and count neighbors with [pcolor = yellow] < 3 [
      ;; pick up food
      set has-food? true
      ;; remove food from patch
      set pcolor green

to eat-food
  if pcolor = yellow and count neighbors with [pcolor = yellow] > 2 [
    set pcolor green
    set energy (energy + 5)]

to find-pile
  if pcolor = yellow and [pcolor] of patch-ahead 1 != yellow [
    ask patch-ahead 1 [set pcolor yellow]
    set has-food? false

to harvest-time
  if ticks mod 1500 = 0 
  [ ask one-of patches with [pcolor != yellow and 
    count neighbors with [pcolor = yellow] < 3] [set pcolor yellow] ]

to hunt-rabbits
    let prey one-of rabbits-here                    ;; grab a random sheepi
  if prey != nobody                             ;; did we get one?  if so,
    [ ask prey [ die ] 
      set has-rabbit? true] ;; get energy from eating

to eat-rabbit
  set has-rabbit? false
  set energy energy + 10

to reproduce-rabbits  ;; sheep procedure
  if random-float 100000 < rabbit-reproduce [  ;; throw "dice" to see if you will reproduce             ;; divide energy between parent and offspring
    hatch 1 [ rt random 360 fd 1 ]   ;; hatch an offspring and move it forward 1 step

to rabbit-eat
  if pcolor = yellow [set pcolor green]
  set energy energy + 7

There are 2 versions of this model.

Uploaded by When Description Download
Audrey Hosford about 11 years ago Gatherer Model v3 Download this version
Audrey Hosford about 11 years ago Initial upload Download this version

Attached files

File Type Description Last updated
AudreyHosford_May20.docx word Progress Report 5/20 about 11 years ago, by Audrey Hosford Download
AudreyHosford_May27.docx word Progress Report 5/27 about 11 years ago, by Audrey Hosford Download

This model does not have any ancestors.


Graph of models related to 'Gatherer Model v2'