- 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
Ecosystem - Two Species
Submitted by librarian on Tue, 2006-08-08 12:43. :: Category
WHAT IS IT?
This project explores the interactions that occur in an ecosystem with two species competing for resources. In this model, agents are the two different types of animal: rabbits and jackrabbits. The environment consists of the two types of grass (one type adapted for each species), and landscape features (like rivers) that effect the movement of the rabbits. As the agents move around on the landscape, they feed on grass they find which increases their energy, but each step they take also decreses their energy. If the agents energy reaches zero, then they will die. If they meet a rabbit of the same breed but opposite gender as themself and have enough energy, then they can reproduce.
HOW TO USE IT
Click the SETUP button to setup the turtles and grass. The prarie and river buttons can be used to select different landscapes. Click the move button to start the simulation. The red # (male and female) sliders controls the initial number of jackrabbits. The blue # (male and female) slider sets the initial number of rabbits. The grass regrowth slider controls the rate at which grass grows. The graph-it button starts the plot.
THINGS TO NOTICE
Watch the ecosystem graph to see how the number of each species changes. You can also watch the red and blue grass monitors to see how the number of each grass type change over time.
EXPLORATIONS
Is the current grass regrowth value capable of supporting an infinite number of agents, or is there a limit? How is that limit determined? How does the initial number of each rabbit type and gender affect the ecosystem?
Turtle procedures
turtles-own [energy age] ;Each turtle has an energy and age variable
breeds [mrabbit frabbit mjackrabbit fjackrabbit grass]
;The five breeds of turtle in this model are male and female rabbits,
;male and female jackrabbits, and grass.
;Gives the turtles the order in which they should perform actions.
to move
if pc-ahead = blue [rt 180] ;If a turtle reaches a river patch, they turn around
check-patches
check-energy
reproduce
fd 1
setage (age + .1)
wait .01
wiggle
check-age
fight
setenergy (energy - .02)
end
;The two types of grass (pc 54 and 53) provide different energy bonuses to the two types
;of rabbit. If rabbits eat their own type of grass (54), or jackrabbits theirs (53), they
;get an energy bonus of 3. If they eat the other type of grass, they only gain 1 energy.
;The grass turtles, if they move to a non grass patch, turn that patch into grass.
to check-patches
if breed = mrabbit or breed = frabbit
[if pc = 54 [stamp brown setenergy (energy + 3) wait .5]]
if breed = mjackrabbit or breed = fjackrabbit
[if pc = 53 [stamp 34 setenergy (energy + 3) wait .5]]
if breed = mrabbit or breed = frabbit
[if pc = 53 [stamp brown setenergy (energy + 1) wait .5]]
if breed = mjackrabbit or breed = fjackrabbit
[if pc = 54 [stamp 34 setenergy (energy + 1) wait .5]]
if breed = grass
[if pc = brown [stamp 54]]
if breed = grass
[if pc = 34 [stamp 53]]
end
;Makes the turtles randomly change their heading slightly.
to wiggle
rt random 20
lt random 20
end
;For non grass turtles, if their energy reaches 0, they die. This procedure
;also creates an energy cap of 30, preventing turtles from having too much energy.
to check-energy
if breed != grass [
if energy <= 0 [die]
if energy >= 30 [setenergy 30]
]
end
;If a male and female rabbit of the same breed are on the same patch, and they both have more than
;five energy, they reproduce. The new turtle is randomly male or female.
to reproduce
if breed = mrabbit and (breed-of one-of-turtles-here) = frabbit and energy >= 5
[setenergy (energy / 2)
hatch
[ifelse (random 2) = 0
[setbreed mrabbit setc red]
[setbreed frabbit setc 13]
setage 0
]
]
;Same as above, except for jackrabbits.
if breed = mjackrabbit and (breed-of one-of-turtles-here) = fjackrabbit and energy >= 5
[setenergy (energy / 2)
hatch
[ifelse (random 2) = 0
[setbreed mjackrabbit setc blue]
[setbreed fjackrabbit setc 103]
setage 0
]
]
;This ensures that the female rabbits envolved in reproduction also have their energy halved.
if breed = frabbit and (breed-of one-of-turtles-here) = mrabbit and energy >= 5
[setenergy (energy / 2)
]
if breed = fjackrabbit and (breed-of one-of-turtles-here) = mjackrabbit and energy >= 5
[setenergy (energy / 2)
]
fd 1 wait .01
end
;When rabbits or jackrabbits are older than 250 steps (each step increments age by .1), they die.
to check-age
if breed != grass [
if age >= 25 [die]
]
end
;If rabbits of different breeds occupy the same space, they fight, halving their energy.
to fight
if breed = mjackrabbit or breed = fjackrabbit
and ((breed-of one-of-turtles-here) = mrabbit or (breed-of one-of-turtles-here) = frabbit)
[setenergy (energy / 2)]
if breed = mrabbit or breed = frabbit
and ((breed-of one-of-turtles-here) = mjackrabbit or (breed-of one-of-turtles-here) = fjackrabbit)
[setenergy (energy / 2)]
end
to wigglemon
rt random 90
lt random 90
end
Observer procedures
patches-own [image1 image2]
;To set up the model, each breed of turtle is created based on their respective slider,
;their colors set (shades of red for M and F rabits, blue for M and F jackrabbits),
;their energy and age variables set, and depending on the breed they are placed in different locations.
to setup
ct
create-and-do mrabbit-number
[setbreed mrabbit setc red setxy -50 -50 setenergy 1 set age 0]
create-and-do frabbit-number
[setbreed frabbit setc 13 setxy -50 -50 setenergy 1 set age 0]
create-and-do mjackrabbit-number
[setbreed mjackrabbit setc blue setxy 50 50 setenergy 1 set age 0]
create-and-do fjackrabbit-number
[setbreed fjackrabbit setc 103 setxy 50 50 setenergy 1 set age 0]
create-and-do grass-rate
[setbreed grass seth random 360 set age 0 ht setc black]
setup-graph
end
;To create a monsoon in the environment, the grass turtles check the color of their patch, and
;if it is not already grass they stamp it green.
to monsoon
stopmovebutton
ask-turtles
[
if breed = grass
[if pc = brown
[stamp blue wait .05 stamp 54]]
if breed = grass
[if pc = 34
[stamp blue wait .05 stamp 53] fd 2 wigglemon]
if breed != grass
[stop]
]
end
;Unnecessary procedure.
;to end-world
; ct
; create-and-do 1000 [setxy (random screen-width) (random screen-height) setc white]
; wait .5
; cg
; ask-turtles [
; repeat 10 [fd (random 5) rt (random 180) lt (random 180)]
; repeat 75 [seth towards (random screen-width) 0 fd (random 5)]
; repeat 50 [seth towards 0 0 fd (random 5)]
; die
; ]
;end
;This procedure sets up the graph by creatng two plots and defining the axis range and titles.
to setup-graph
pp 1 ppreset setppc red ppd
pp 2 ppreset setppc blue ppd
setplot-title "Ecosystem"
setplot-yrange 0 500
setplot-xrange 0 500
setplot-xlabel "time"
setplot-ylabel " rabbits, jackrabbits"
viewplot
end
;Plot 1 shows the number of rabbits (male and female), and plot 2 shows the total jackrabbits
to graph-it
pp 1 plot count-mrabbit + count-frabbit
pp 2 plot count-mjackrabbit + count-fjackrabbit
end
to stop-display
no-display
end
to start-display
display
end
3217 reads
