- Art
- Astronomy
- Biology
- Selection and Mutation Series
- Ant Patterns
- Bacterial Growth
- Bark Beetles
- Biological Buffer
- Birds Competing For Worms
- Color Bunnies
- Ecosystem - Predator, Prey, and Grass
- Ecosystem - Rabbits and Grass
- Ecosystem - Two Species
- Ecosystem With Predator, Prey, And Grass
- Forest Fire
- Honeycomb Formation
- Termites Perimeter
- Yeast Growth
- Chemistry
- Earth Science
- Mathematics
- Physics
- Social Science
Birds Competing For Worms
WHAT IS IT?
This model explores competition between two different species of birds (cardinals and bluejays) for food (worms). Both the birds and worms in this model are agents, but the worms act only indirectly since they only effect the environment, which in turn affects the birds. Worms and birds both wander randomly around the landscape. Worms create brown (food) patches when they come to a pre-existing brown patch. Birds have an energy variable that decreases each time they move. When they land on a brown patch, they eat this patch and increase their energy. When their energy is above a threshold set by a slider, they reproduce. If their energy drops to zero, they die. When two birds occupy the same patch, they fight and drain the other bird's energy.
HOW TO USE IT
Click the Setup button to place birds and worms on the landscape. Click the Add Birds button if you want to add more birds at any time. The Start button initiates the simulation. The worm-rate slider controls the initial number of brown patches. The number-of-birds slider sets the number of birds created initially as well as the number created if the Add Birds button is pressed. The precent-bluejays slider controls the ratio of the two bird species. The reproduce-level slider sets the level of energy at which birds reproduce The endurance slider controls how quickly birds lose energy The four sliders at the bottom set what energy penalty is faced by birds when they meet other birds. Each slider controls one of the four possible meetings.
THINGS TO NOTICE
The plot window graphs the number of bluejays (blue line), cardinals (red line) and worms (actually the number of brown patches, brown line) over time.
EXPLORATIONS
How does the ratio of cardinals to bluejays effect their populations after a while? How do the reproduce-level and endurance sliders effect the birds' populations? Will any of the three species of agents ever die out? How does the worm-rate variable effect the number of birds the environment can support? Thanks to Mike Mandel
Turtle procedures
breeds [bluejays cardinals worms] ;This defines the different breeds of turtles:
;two types of birds (the predators) and worms (the prey)
turtles-own [energy] ;Turtles each have an energy variable that is modified as they
;move and eat.
;All worms in the model turn randomly, move, and if they are in front of
;a brown patch, they stamp their current patch brown.
to grow
if (breed != worms) [stop]
rt (random 50) - 25
step
if pc-ahead = brown [stamp brown]
end
;This procedure serves as a "to-do" list for both bird breeds. It is called by the Start button and tells
;the turtles in what order to execute the various sub-procedures explained below.
to wander
if breed = worms [stop]
draw
walk
interact
eat
reproduce
death
end
;If a turtle is a non-worm breed, it turns randomly, moves in this new directon, and reduces its energy.
to walk
if breed = worms [stop]
rt (random 50) - 25
step
setenergy energy - 1 + endurance / 100
end
;This procedure defines what the turtles should do when they meet eachother. In this model, whenever
;birds occupy the same patch, they compete with eachother, depleting the other birds energy. Depending on the
;birds meeting (bluejay with bluejay, bluejay with cardinal, cardinal with bluejay..etc), different amounts of
;energy are lost. These values are determined by sliders.
to interact
if breed = bluejays
[
grab one-of-bluejays-here
[
setenergy-of partner ((energy-of partner) - blues-hurt-blues / 50)
]
grab one-of-cardinals-here
[
setenergy-of partner ((energy-of partner) - blues-hurt-reds / 50)
]
]
if breed = cardinals
[
grab one-of-bluejays-here
[
setenergy-of partner ((energy-of partner) - reds-hurt-blues / 50)
]
grab one-of-cardinals-here
[
setenergy-of partner ((energy-of partner) - reds-hurt-reds / 50)
]
]
end
;When turtles find themselves on a brown (food) patch, they eat the food by increasing their energy
;by one and setting the patch color to black indicating it has been eaten.
to eat
if pc = brown
[
stamp black
setenergy energy + 1
]
end
;When turtles have enough energy to reproduce (at least the amount defined by the "reproduce-level" slider), they
;decrease their energy by half and create a new, identical turtle.
to reproduce
if (energy > reproduce-level)
[
setenergy energy / 2
hatch []
]
end
;When turtles walk around for too long without finding food, their energy eventually decreases to zero, causing
;them to die.
to death
if (energy < 0) [die]
end
;This procedure is called by the setup procedure and causes the turtles to scale their color based on their
;energy level.
to draw
if breed = bluejays [scale-color blue energy 0 reproduce-level]
if breed = cardinals [scale-color red energy 0 reproduce-level]
end
Observer procedures
;This procedure sets up the simulation. It clears the screen, calls the procedure to intialize the graph, and
;creates a number of each breed of turtles based on slider values. The turtles are then each given a random
;position and a random energy level between 0 and the level of energy needed for reproduction.
to setup
ca
setup-plot
create-worms-and-do worm-rate * 2
[
setc black
ht
]
create-bluejays number-of-birds * percent-bluejays / 100
create-cardinals number-of-birds * (1 - percent-bluejays / 100)
ask-turtles
[
setxy random screen-width random screen-height
setenergy random reproduce-level
if shown? [setshape bird-shape]
draw
]
ask-patches
[
if ((random 100) < worm-rate) [setpc brown]
]
end
;This procedure, triggered by the "Add Birds" button, creates another set of birds equal to the value of the
;"number of birds" slider. This group of birds is composed of bluejays and cardinals in the percentage defined
;by the "percent bluejays" slider. After the birds are created, they are given a random position and random energy
;level.
to more-birds
create-bluejays-and-do number-of-birds * percent-bluejays / 500
[
setxy random screen-width random screen-height
setenergy random 10
draw
]
create-cardinals-and-do number-of-birds * (1 - percent-bluejays / 100) / 5
[
setxy random screen-width random screen-height
setenergy random 10
draw
]
end
;This procedure sets up the graph that displays information about the model. Using a procedure
;like this is unneccessary in newer versions of Starlogo, where youc an just use the "Create or edit a plot"
;button and define the graph through Starlogo's wizard.
to setup-plot
clearplot
pp 1 setppc blue
pp 2 setppc red
pp 3 setppc brown
setplot-title "Number of birds and worms"
setplot-xmax 25
setplot-ymax 100
end
to plot-numbers
pp 1 plot count-bluejays
pp 2 plot count-cardinals
pp 3 plot (count-patches-with [pc = brown]) / 7
end
;This procedure is linked to the Start button and initiates the entire model. It starts the graph plotting
;and activates the wander and grow buttons which in turn activate specific procedures.
to all-start
startgraph
startwanderbutton
startgrowbutton
end
;This procedure stops the entire model.
to all-stop
stopgraph
stopwanderbutton
stopgrowbutton
end
10193 reads
