Gatherer Model v3

No preview image

1 collaborator

Default-person Audrey Hosford (Author)

Tags

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

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


## PROGRESS MAY 13

Agent behavior

At present, the gatherers work to collect food from random locations on the map. If they do not have food in their possession, they go find it. If they have food, they look for a large collection of food nearby in which to put their food.

System behavior

At present no other system behavior has been implemented.

Rationale for agent rules

The gatherer agents need to fulfill their roles as gatherers. Implementing these rules keeps them gathering constantly until there are no uncollected pieces of food.

Next steps

• Implement food consumption and energy burning

• Implement food regeneration

• Implement another tribe of gatherers

## HOW IT WORKS

Initialize:

Create # of gatherers and scatter.

Create chosen density of grain to gather and scatter those patches.

At each tick, each gatherer:

I look for a yellow grain patch.

When I find a yellow grain patch, I pick it up.

If I have a grain patch, I take it to another grain pile.

If I find a grain pile, I put the grain there.

If I have deposited grain, I can eat a different patch of grain.

If there is no grain left on the ground and I have no grain with me, I stop moving.

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
             patience
             has-rabbit? ]
gatherers-own [has-food?
             energy ]
rabbits-own [ energy ]

to setup
  clear-all
  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
  ]
  reset-ticks
end 

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

  ask turtles [
    move    
    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]
    harvest-time
    ask turtles with [energy <= 0] [die]
    ]
  tick
end 


;; We move in a separate procedure

to move 
  fd 1
  rt 20 - random 40
end 


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

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

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

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

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
end 

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

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

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

There is only one version of this model, created over 5 years ago by Audrey Hosford.

Attached files

File Type Description Last updated
AudreyHosford_June3.docx word Progress Report 6/3 over 5 years ago, by Audrey Hosford Download

Parent: Gatherer Model v2

This model does not have any descendants.

Graph of models related to 'Gatherer Model v3'