Bug Hunters Competition
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This model shows how competition emerges between individuals in the same population. In a consumer / producer ecosystem, competition for shared resources emerges whenever there is a limited sappy of those resources. Such competition may be intentional or unintentional, but similar outcomes result in either case - some individuals outcompete others for those shared resources.
Even when individuals are identical, differences in where and when shared resources in the ecosystem are available will lead to variation in competitive advantages for some individuals over time (some individuals happen to be closer to those resources than other individuals). This variation in competitive advantage, will enable some individuals to survive while others die.
The degree of competition in an ecosystem depends on the number of individuals in the ecosystem and the amount of resources available per individual. A very small number of individuals may generate very little or no competition (individuals may have all the resources that they need). However, many individuals will generate intensive competition for resources, such that very few resources are available for each individual and many individuals will die for lack of adequate resources.
HOW IT WORKS
In this model, you can have two kinds of bugs; bugs controlled by players using HubNet or automated bugs.
Each HubNet player assumes the role of a consumer. When the HubNet simulation is started after pressing GO, players should try to eat as much grass as they can. A bug controlled by a player may be turned left or right by clicking on a destination in the client view of the World. As the controlled bug moves across a green patch, some of the "grass" at the spot is automatically eaten. Grass grows at a fixed rate, and when it is eaten, a fixed amount of grass energy is deducted from the patch (square) where the grass was eaten and a fixed amount of time must pass before new grass grows back at that spot.
In addition, automated bugs can be included in the model. They wander around the world randomly, eating grass.
When bugs-lose-energy? is on, bugs lose energy at each step and they must eat grass to replenish their energy. When they run out of energy, they die. Automated bugs can be set to reproduce automatically when they have enough energy to have an offspring. In such a case, the offspring and parent split the energy amongst themselves.
HOW TO USE IT
Make sure you select Mirror 2D view on clients in the HubNet Control Center. Once all the players have joined the simulation through hubnet, press SETUP. To run the activity, press GO.
To start the activity over with the same group of players, stop the model by pressing the GO button again, press the SETUP button, and press GO again. To run the activity with a new group of players press the RESET button in the Control Center.
The controls included in this model are:
AMOUNT-GRASSLAND: The percentage of patches in the World & View that produce grass.
INITIAL-NUMBER-AUTOMATED-BUGS: The initial size of bug population that is not controlled by a player.
SPROUT-DELAY-TIME: Controls how long before "eaten" grass starts sprouting and growing back. Increase this value for large numbers of players to make the competition more difficult (and when there are no automated bugs in the ecosystem). Decrease this value for small numbers of players and when there are lots of automated bugs in the ecosystem.
LENGTH-COMPETITION: Determines how long the competition will last. The unit of length is ticks.
INCLUDE-CLIENTS-AS-BUGS?: When "On", all HubNet connected clients will be given an individual bug to control that is assigned to their client when SETUP is pressed. When this is "Off", the model will run only on your local machine.
AUTOMATED-BUGS-WANDER?: When "On", automated bugs will turn a random amount left or right (between 30 and -30 degrees from its current heading) each tick. When "off" the automated bugs will move in a straight line.
AUTOMATED-BUGS-LOSE-ENERGY?: When "On", bugs lose one unit of energy for each tick.
AUTOMATED-BUGS-REPRODUCE?: When "On", automated bugs will reproduce one offspring when they reach a set threshold of energy. The parent bug's energy will be split between the parent and the offspring. The count of offspring is kept track of in the monitor "# OFFSPRING".
PLAYER-VISION: Used to set the radius shown when hubnet-send-follow is applied for sending a client view update for each player showing a radius sized Moore neighborhood around the bug the player is controlling.
SHOW-LABELS-AS: when set to "player name" will show a player name label next to each bug controlled by a client. When set to "energy levels" will show the amount of energy on the label next to each bug (controlled by clients and automated bugs). When set to "energy ranges" will show the range of energy values and the energy value of all bugs in this format "[min, max]: this bug". When set to "player energy:name" will show the player energy for their bug followed by a colon and then their user name, for only the bugs controlled by clients.
The plots in the model are:
ENERGY LEVELS OF BUGS: Shows a histogram of bugs and their respective energy levels.
POPULATION SIZE: Shows the size of the bug population size over time.
X-INTERVAL: reports whatever the x-interval is for 20 bars in the historgram range. It is being reported for use in the classroom BEAGLE activity where students build a histogram using the same x-interval as the NetLogo ENERGY LEVELS OF BUGS graph.
Note: Grass squares grow back (become darker green) over time and accumulate more stored energy (food) as they become darker.
THINGS TO NOTICE
The histogram of ENERGY LEVELS OF BUGS will show that some bugs are more successful at gaining more energy from plants than others. The histogram will show this when the bugs are intentionally being controlled by players, when they are being randomly controlled by the computer, and any combination of both.
When BUGS-LOSE-ENERGY is set to "off", the histogram will keep drifting further to the right then when it is set to "on".
For large populations of participants or large populations of automated bugs, the histogram for ENERGY LEVELS OF BUGS will tend to approximate a bell shaped curve. When both participants and automated bugs are present, two histograms tend to form showing a bi-modal bell-shaped distribution, where the intentionally competing participants tend to be in the right shifted bell-shaped distribution and the automated bugs tend to be in the left shifted bell-shaped distribution.
THINGS TO TRY
If you adjust the PLAYER-VISION, does changing the radius of vision for each player effect their ability to compete? Does the shape of the histogram change for the competition?
If you adjust the AMOUNT-OF-GRASSLAND, does less grassland affect the shape of the histogram change for the competition?
How does LENGTH-OF-COMPETITION affect the spread of the distribution in the histogram?
EXTENDING THE MODEL
The model could be extended for some player to control predators and others to control consumers. Alternately, some players could control consumers on one team (one type of color of bugs) and some players could control consumers on another team (another type of color of bugs). Such a competition between teams may still tend to result in similar shaped and similar shifted histograms for energy level distributions for each team of bugs.
NETLOGO FEATURES
Each player gets a different view, attached to their own player turtle, which is in turn attached to a bug they are steering. These customized views for following a turtle are sent to each client using the hubnet-send-follow command.
RELATED MODELS
Look the Wolf Sheep Predation model, Bug Hunt Consumers model, Bug Hunt Predation and Bug Hunt Invasive Species model.
CREDITS AND REFERENCES
This model is a part of the BEAGLE curriculum (http://ccl.northwestern.edu/simevolution/beagle.shtml)
HOW TO CITE
If you mention this model in a publication, we ask that you include these citations for the model itself and for the NetLogo software:
- Novak, M. and Wilensky, U. (2011). NetLogo Bug Hunters Competition model. http://ccl.northwestern.edu/netlogo/models/BugHuntersCompetition. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
COPYRIGHT AND LICENSE
Copyright 2011 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California 94305, USA.
Commercial licenses are also available. To inquire about commercial licenses, please contact Uri Wilensky at uri@northwestern.edu.
Comments and Questions
globals [ ;; global variables related to color bugs-color grass-color dirt-color invasive-color not-grown-back-color ;; global variables related to bugs bugs-size ;; the shape size for a bug bugs-stride ;; how much a bug moves at every tick bugs-reproduce-energy ;; energy at which bugs reproduce min-energy-of-any-bug ;; energy of the bug with the lowest energy in the population max-energy-of-any-bug ;; energy of the bug with the maximum energy in the population dead-bugs ;; keeps count of the number of bugs that have died in a model run offspring-bugs ;; keeps count of the number of bugs reproduced by automated bugs bugs-energy-from-food ;; energy that the bug eat from the food (the grass) each tick ;; set to 4 in this model, but is adjustable in other Bug Hunt models (such as Bug Hunt Consumers). ;; global variables related to grass max-grass-energy ;; the most amount of grass that can grow in a single patch (determined by a max. energy threshold) grass-growth-rate ;; set to 1 in this model, but is adjustable in other Bug Hunt models (such as Bug Hunt Consumers). competition-status ;; updates users with a message about the status of the competition ;; global variables related to time and histogram time-remaining ;; time left for the competition to end x-min-histogram x-max-histogram x-interval-histogram old-player-vision ] breed [ bugs bug ] breed [ players player ] bugs-own [destination-patch controlled-by-player? owned-by energy] players-own [destination-patch user-id dead?] patches-own [ fertile? ;; whether or not a grass patch is fertile is determined by the amount-grassland slider grass-energy ;; energy for grass countdown ] to startup ;; setting up hubnet hubnet-set-client-interface "COMPUTER" [] hubnet-reset setup end to setup ask bugs [die] clear-all-plots ;; time variables set time-remaining 0 ;; variables for the histogram set x-min-histogram 0 set x-max-histogram 0 set x-interval-histogram 0 set old-player-vision 0 ;; variables for grass set max-grass-energy 100 set grass-growth-rate 1 ;; set to 1 by default in this model. But in other Bug Hunt Models (such as Bug Hunt Consumers), this is adjustable ;; In other Bug Hunt Models (such as Bug Hunt Consumers), grass-growth-rate has a default of 1, but is slider adjustable. ;; variables for bugs set-default-shape bugs "bug" set bugs-size 1.0 set bugs-stride 0.2 set bugs-reproduce-energy 100 set bugs-energy-from-food 4 ;; set to 4 by default in this model. ;; In other Bug Hunt Models (such as Bug Hunt Consumers), bug-energy-from-food has a default of 4, but is slider adjustable. set dead-bugs 0 set offspring-bugs 0 ;; setting colors set bugs-color (violet ) set grass-color (green) set dirt-color (gray - 1) set not-grown-back-color white set competition-status "Get Ready" add-starting-grass if include-clients-as-bugs? [ask players [assign-bug-to-player]] add-bugs listen-clients check-reset-perspective display-labels reset-ticks set time-remaining (length-competition - ticks) send-all-info end to setup-a-new-bugs-for-a-new-player [p-user-id] set hidden? false set color (magenta - 1) set size 1.4 ;; easier to see set label-color blue set energy 10 * bugs-energy-from-food set owned-by p-user-id set controlled-by-player? true update-statistics end to go if ticks < length-competition [ set competition-status "Running" update-statistics listen-clients send-all-info ask patches [ grow-grass ] ask bugs [ if automated-bugs-lose-energy? [ set energy energy - 1 ] ;; deduct energy for bugs only if bugs-lose-energy? switch is on if automated-bugs-reproduce? [ reproduce-bugs ] if automated-bugs-wander? [right random 30 left random 30] fd bugs-stride bugs-eat-grass bug-death ] display-labels check-reset-perspective tick set time-remaining (length-competition - ticks) ] if ticks = length-competition [ display set competition-status "Over" if time-remaining <= 0 [set time-remaining 0] send-all-info tick ] end to add-starting-grass ask patches [ ifelse random 100 < amount-grassland ;; the maximum number of fertile patches is set by a slider [ set fertile? true set grass-energy max-grass-energy ] [ set fertile? false set grass-energy 0 ] color-grass ] end to add-bugs create-bugs initial-#-automated-bugs ;; create the bugs, then initialize their variables [ set color bugs-color set size bugs-size set controlled-by-player? false set energy 10 * bugs-energy-from-food setxy random world-width random world-height ] end to bugs-eat-grass ;; bugs procedure ;; if there is enough grass to eat at this patch, the bugs eat it ;; and then gain energy from it. if grass-energy > bugs-energy-from-food [ ;; grass lose ten times as much energy as the bugs gains (trophic level assumption) set grass-energy (grass-energy - (bugs-energy-from-food * 10)) set energy (energy + bugs-energy-from-food) ;; bugs gain energy by eating ] ;; if grass-energy is negative, make it positive if grass-energy <= bugs-energy-from-food [set countdown sprout-delay-time ] end to reproduce-bugs ;; automated bugs procedure if (energy > ( bugs-reproduce-energy)) [ if random 2 = 1 and not controlled-by-player? ;; only half of the fertile bugs reproduce (gender) [ set energy (energy / 2) ;; lose energy when reproducing - energy is divided between offspring and parent hatch 1 [ ;; hatch an offspring set it heading off in a a random direction and move it forward a step set offspring-bugs (offspring-bugs + 1) set size bugs-size set color bugs-color rt random 360 fd bugs-stride ] ] ] end to bug-death ;; bugs die when energy dips below zero (starvation) if (energy < 0) [ set dead-bugs (dead-bugs + 1) die ] end to grow-grass ;; patch procedure set countdown (countdown - 1) ;; fertile patches gain 1 energy unit per turn, up to a maximum max-grass-energy threshold if fertile? and countdown <= 0 [ set grass-energy (grass-energy + grass-growth-rate) if grass-energy > max-grass-energy [set grass-energy max-grass-energy] ] if not fertile? [set grass-energy 0] if grass-energy < 0 [set grass-energy 0 set countdown sprout-delay-time] color-grass end to color-grass ifelse fertile? [ ifelse grass-energy > 0 ;; scale color of patch from whitish green for low energy (less foliage) to green - high energy (lots of foliage) [set pcolor (scale-color green grass-energy (max-grass-energy * 2) 0)] [set pcolor not-grown-back-color] ] [set pcolor dirt-color] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; player enter / exit procedures ;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to create-new-player create-players 1 [ set dead? true set user-id hubnet-message-source set hidden? true assign-bug-to-player ] end to assign-bug-to-player if include-clients-as-bugs? [ let p-user-id user-id let parent-player self let child-bug nobody setxy random-xcor random-ycor ask bugs with [p-user-id = owned-by] [die] hatch 1 [ set breed bugs set child-bug self setup-a-new-bugs-for-a-new-player p-user-id ask parent-player [ create-link-from child-bug [ tie ] set dead? false] ] ] end to remove-player ask bugs with [owned-by = hubnet-message-source and controlled-by-player?] [die] ask players with [user-id = hubnet-message-source] [ die ] end ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;; Handle client interactions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; to listen-clients while [ hubnet-message-waiting? ] [ hubnet-fetch-message ifelse hubnet-enter-message? [ create-new-player ] [ ifelse hubnet-exit-message? [ remove-player ] [ ask players with [user-id = hubnet-message-source] [execute-command hubnet-message-tag hubnet-message ]] ] ] end to check-reset-perspective if player-vision != old-player-vision [ ask players [ hubnet-reset-perspective user-id hubnet-send-follow user-id self player-vision ] set old-player-vision player-vision ] end to execute-command [command msg] if command = "View" [ orient-my-turtle command msg ] end to execute-turn [new-heading] set heading new-heading end to display-labels let b-color 0 let energy-range (word " [" min-energy-of-any-bug " to " max-energy-of-any-bug "]: ") ask bugs [ set label-color black if show-labels-as = "none" [set label ""] if show-labels-as = "player energy" [ set label (word round energy) ] if show-labels-as = "energy ranges" [ set label (word energy-range round energy) ] if show-labels-as = "player name" [ ifelse controlled-by-player? [set label owned-by] [set label ""] ] if show-labels-as = "player energy:name" [ ifelse controlled-by-player? [set label (word round energy ":" owned-by)] [set label ""] ] ] end to orient-my-turtle [name coords] let next-destination-patch patch first coords last coords if patch-here != destination-patch [ ask my-agent [ set destination-patch next-destination-patch face destination-patch ] ] end to-report my-agent let this-user-id user-id let my-bug nobody set my-bug bugs with [owned-by = this-user-id] report my-bug end to-report energy-of-your-bug let this-user-id user-id let this-bug-energy 0 if any? bugs with [owned-by = this-user-id] [ ask bugs with [owned-by = this-user-id] [set this-bug-energy energy] ] report this-bug-energy end to send-this-players-info ;; player procedure ;; update the monitors on the client let message-to-send "" let my-energy energy-of-your-bug let place 1 + (count bugs with [energy > my-energy]) let num-ties count bugs with [energy = my-energy] let total-number-bugs count bugs let any-ties "" let out-of (word " out of " total-number-bugs " ") if num-ties > 1 [set any-ties (word " [" num-ties "-way tie]") ] ifelse include-clients-as-bugs? [set message-to-send (word place out-of any-ties)] [set message-to-send "not currently in this competion"] hubnet-send user-id "Your Place in the Competition" message-to-send end to send-all-info ;;send common info to this client ask players [send-this-players-info] hubnet-broadcast "time remaining" time-remaining end to update-statistics if any? bugs [ set min-energy-of-any-bug precision (min [energy] of bugs ) 1 set max-energy-of-any-bug precision (max [energy] of bugs ) 1 ] end ; Copyright 2011 Uri Wilensky. ; See Info tab for full copyright and license.
There are 4 versions of this model.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Bug Hunters Competition.png | preview | Preview for 'Bug Hunters Competition' | over 11 years ago, by Uri Wilensky | Download |
This model does not have any ancestors.
This model does not have any descendants.