Jacks vs Bears

Jacks vs Bears preview image

1 collaborator

Default-person Albano Borba (Author)

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by the author
Model was written in NetLogo 5.3.1 • Viewed 267 times • Downloaded 39 times • Run 0 times
Download the 'Jacks vs Bears' modelDownload this modelEmbed this model

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


WHAT IS IT?

Forests are very complex eco-systems with lots of things happening. For this simulation was created a virtual forest and watch over simulated time the effects of a forest. We will see trees grow and be harvested. We will see the impact of industry upon the forest and watch as the wild life "fights" back.

For this simulated forest we will be dealing with 3 aspects:

Trees which can be a Sapling, Tree or Elder Tree;
Lumberjacks (He chops down down trees);
Bears (He "maws" the lumberjacks).

HOW IT WORKS

The simulation will simulate by months. Each "tick" represents a month. Every 12 "ticks" represents a year. Our forest will change and be in constant change.

Forest:

The forest will be a two dimensional forest of size 50 x 50. At each location you can hold Trees, Bears or Lumberjacks. They can occupy the same spot but often events occur when they occupy the same spot. The forest will be spawned randomly.

Trees:

The initial number of trees is given by the slider "ini_trees" and other agents will be created based on this number.

Every month a Tree has a 1% chance to spawn a new "Sapling". In a random open space adjacent to a Tree you have a 1% chance to create a "Sapling". For example a Tree in the middle of the forest has 8 other spots around it. One of these if they do not have a type of Tree in it will create a "Sapling".

After 12 months of being in existence a "Sapling" will be upgrade to a "Tree". A "Sapling" cannot spawn other trees until it has matured into a "Tree".

Once a "Sapling" becomes a tree it can spawn other new "Saplings". At this point once a "Sapling" matures into a "Tree" it exists and matures. When a "Tree" has been around for 120 months (10 years) it will become an "Elder Tree".

Elder Trees have a 2% chance to spawn a new "Sapling" instead of 1%.

If there are no open adjacent spots to a Tree or Elder Tree it will not spawn any new Trees.

Lumberjacks:

The Amounts of lumberjacks is given by 20% of the slider "ini_trees". They will move a randomly picked spot that is adjacent in any direction. So for example a Lumberjack in the middle of your grid has 8 spots to move to.

When the lumberjack moves if he encounters a Tree (not a sapling) he will then harvest the Tree for lumber. Remove the tree. Gain 1 piece of lumber. Lumberjacks will not harvest "Sapling". They will harvest an Elder Tree. Elder Trees are worth 2 pieces of lumber.

Every 12 months the amount of lumber harvested is compared to the number of lumberjacks in the forest. If the lumber collected equals or exceeds the amount of lumberjacks in the forest a new lumberjack is hired and randomly spawned in the forest. Actually a math formula is used to determine if we hire 1 or many lumberjacks. We hire a number of new lumberjacks based on lumber gathered. Let us say you have 10 lumberjacks. If you harvest 10-19 pieces of lumber you would hire 1 lumberjack. But if you harvest 20-29 pieces of lumber you would hire 2 lumberjacks. If you harvest 30-39 you would gain 3 lumberjacks. And so forth.

However if after a 12 month span the amount of lumber collected is below the number of lumberjacks then 1 random lumberjack is removed from the forest. However you will never reduce your Lumberjack labor force below 0.

Bears:

They wander the forest much like a lumberjack and the amount of bears is given by 4% of the slider "ini_trees". If a bear comes across a Lumberjack he "maw" and hurt the lumberjack. The lumberjack will be removed from the forest.

We will track this as a "Maw" accident. During the course of 12 months if there 0 "Maw" accidents then the Bear population will increase by 1. If however there are any "Maw" accidents the Lumberjacks will hire a Zoo to trap and take a Bear away. Remove 1 random Bear. Note that if your Bear population reaches 0 bears then there will be no "Maw" accidents in the next year and so you will spawn 1 new Bear next year.

If there is only 1 lumberjack in the forest and he gets Maw'd. He will be sent home. But a new one will be hired immediately and respawned somewhere else in the forest. The lumberjack population will not drop below 1.

The simulation occurs for 4800 months (400 years). Or until there 0 Trees left in the forest. So no Saplings, Trees or Elder Trees exist.

HOW TO USE IT

The interface is very simple: A "Setup" to set the simulation and a "Go" button to start it.

There are some monitors that represetam the current value of the variable importates simulation and agents, which are also shown in the plot.

Finally, a slider for the variable "ini_tree" which governs the initial value of our agents.

THINGS TO NOTICE

Besides the beautiful sprites specially developed for this simulation, it is interesting to note the graph variation that is the number of agents in the environment for different values of "ini_trees".

THINGS TO TRY

The slider "ini_trees" can be changed to the observation of new behaviors.

Changes of some parameters in the code (chances for "spaw", for example) may also be of 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)

Comments and Questions

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

Click to Run Model

breed [saplings sapling]
breed [trees tree]
breed [elder_trees elder_tree]
breed [jacks jack]
breed [bears bear]

saplings-own [age]

trees-own [age lumber]

elder_trees-own [lumber]

globals [lumber_pieces maws!]

to setup
  ca
  create_trees ini_trees
  create_jacks ini_trees * 0.2
  create_bears ini_trees * 0.04

  set lumber_pieces 0
  set maws! 0
  import-drawing "grass3.png"
  reset-ticks
end 

to go
  if (count trees + count elder_trees + count saplings) = 0 or ticks = 4800
  [
    stop
  ]

  if count jacks < 1
  [
    create_jacks 1
  ]

  activities_trees
  activities_animals

  tick

  if ticks mod 12 = 0
  [
    rh_jacks
    zoo
  ]
end 

to activities_trees
  ask trees
  [
    spawn 1
    ages_tree
  ]

  ask elder_trees
  [
    spawn 2
  ]

  ask saplings
  [
    ages_sapling
  ]
end 

to activities_animals
  ask jacks
  [
    move
    cut
  ]

  ask bears
  [
    move
    maw
  ]
end 

to create_trees [number]
  create-trees number
  [
    move-to one-of patches with [not any? other turtles-here]
    setxy random-xcor random-ycor
    set color green
    set shape "tree_v2"
    set size 3
    set age 0
    set lumber 1
  ]
end 

to create_jacks [number]
  create-jacks number
  [
    move-to one-of patches with [not any? other turtles-here]
    setxy random-pxcor random-pycor
    set color red + 3.5
    set shape "jack_v2"
    set size 3
  ]
end 

to create_bears [number]
  create-bears number
  [
    move-to one-of patches with [not any? other turtles-here]
    setxy random-pxcor random-pycor
    set color brown - 1
    set shape "bear_v2"
    set size 3
  ]
end 

to move
  rt random 50
  lt random 50
  fd 1
end 

to spawn [number]
  let chance_to_spawn random 100
  if chance_to_spawn < number and count (neighbors with [not any? other turtles-here]) > 0
  [
    hatch-saplings 1
    [
      move-to one-of neighbors with [not any? other turtles-here]
      set color green
      set shape "sapling_v1"
      set size 4
      set age 0
    ]
  ]
end 

to ages_tree
  set age age + 1
  if age = 120
  [
    hatch-elder_trees 1
    [
      set color green - 2
      set shape "tree_v2"
      set size 3
      set lumber 2
    ]
    die
  ]
end 

to ages_sapling
  set age age + 1
  if age = 12
  [
    hatch-trees 1
    [
      set color green
      set shape "tree_v2"
      set size 3
      set age 0
      set lumber 1
    ]
    die
  ]
end 

to cut

  let find one-of trees-here
  if find != nobody
  [
    ask find [ die ]
    set lumber_pieces lumber_pieces + 1

  ]

  set find one-of elder_trees-here
  if find != nobody
  [
    ask find [ die ]
    set lumber_pieces lumber_pieces + 2

  ]
end 

to maw
  let find one-of jacks-here
  if find != nobody
  [
    ask find [ die ]
    set maws! maws! + 1
  ]
end 

to rh_jacks
  ifelse lumber_pieces >= count jacks
  [
    let value int (lumber_pieces / count jacks)
    create_jacks value
  ]
  [
    ask one-of jacks [die]
  ]
  set lumber_pieces 0
end 

to zoo
  ifelse maws! = 0
  [
    create_bears 1
  ]
  [
    ask one-of bears [die]
  ]
  set maws! 0
end 

There is only one version of this model, created about 9 years ago by Albano Borba.

Attached files

File Type Description Last updated
grass3.png background backgorund about 9 years ago, by Albano Borba Download
Jacks vs Bears.png preview Preview for 'Jacks vs Bears' about 9 years ago, by Albano Borba Download

This model does not have any ancestors.

This model does not have any descendants.