Hero and Coward Updated
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
ACKNOWLEDGMENT
This model is from Chapter Two of the book "Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo", by Uri Wilensky & William Rand.
- Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
This model is in the IABM Textbook folder of the NetLogo Models Library. The model, as well as any updates to the model, can also be found on the textbook website: http://www.intro-to-abm.com/.
WHAT IS IT?
The "Heroes and Cowards" game, also called the "Friends and Enemies" game or the "Aggressors and Defenders" game dates back to the Fratelli Theater Group at the 1999 Embracing Complexity conference, or perhaps earlier.
In the human version of this game, each person arbitrarily chooses someone else in the room to be their perceived friend, and someone to be their perceived enemy. They don't tell anyone who they have chosen, but they all move to position themselves either such that a) they are between their friend and their enemy (BRAVE/DEFENDING), or b) such that they are behind their friend relative to their enemy (COWARDLY/FLEEING).
This simple model demonstrates an idealized form of this game played out by computational agents. Mostly it demonstrates how rich, complex, and surprising behavior can emerge from simple rules and interactions.
HOW IT WORKS
The rules of this model are that there are two basic personality types. All agents in the model choose a friend and an enemy. If their personality is BRAVE, then the agent tries to stay between their enemy and their friend, protecting their friend. If their personality is COWARDLY, then the agent tries to keep their friend between them and their enemy, hiding behind their friend.
HOW TO USE IT
Choose the NUMBER of turtles you want to examine, and choose whether the turtles should act COWARDLY, BRAVE, or MIXED. Then press SETUP followed by GO to observe the patterns of behavior formed.
THINGS TO NOTICE
Run the model many times and observe the different patterns of behavior. INSPECT or WATCH some turtles so that you can see their individual behavior.
THINGS TO TRY
Can you find new cool configurations with 68 turtles? How many different type can you find? What happens when you vary the number of turtles?
EXTENDING THE MODEL
There is a bug we deliberately introduced in the SETUP of the model. Can you find it and fix it? Once you have fixed it, how does it affect the preset configurations? Can you find new presets?
Modify the code to add more control over how many of each type of behavior there is.
Change the world wrapping rules to see how that effects the results.
You can create buttons that capture interesting patterns of behaviors by using the RANDOM-SEED function in NetLogo. First set the RANDOM-SEED to different values. PRESS SETUP then GO and observe the behaviors. We created a preset
procedure that makes it easy to create your own buttons that produce interesting behaviors. This procedure assumes a population of 68 turtles with "mixed" behaviors, but you could modify it to allow different settings. Create your own buttons that produce interesting behaviors.
NETLOGO FEATURES
RANDOM-SEED initializes the NetLogo random number generator so that it always produces the same set of random numbers, enabling exact reproduction of model runs.
CREDITS AND REFERENCES
Versions of the Model are described in:
Bonabeau, E., & Meyer, C. (2001). Swarm intelligence. A whole new way to think about business. Harvard Business Review, 5, 107-114.
Bonabeau. E. (2012). http://www.icosystem.com/labsdemos/the-game/ .
Bonabeau, E., Funes, P. & Orme, B. (2003). Exploratory Design Of Swarms. 2nd International Workshop on the Mathematics and Algorithms of Social Insects. Georgia Institute of technology, Atlanta, GA.
Sweeney, L. B., & Meadows, D. (2010). The systems thinking playbook: Exercises to stretch and build learning and systems thinking capabilities.
HOW TO CITE
This model is part of the textbook, “Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo.”
If you mention this model or the NetLogo software in a publication, we ask that you include the citations below.
For the model itself:
- Stonedahl, F., Wilensky, U., Rand, W. (2014). NetLogo Heroes and Cowards model. http://ccl.northwestern.edu/netlogo/models/HeroesandCowards. Center for Connected Learning and Computer-Based Modeling, Northwestern Institute on Complex Systems, Northwestern University, Evanston, IL.
Please cite the NetLogo software as:
- Wilensky, U. (1999). NetLogo. http://ccl.northwestern.edu/netlogo/. Center for Connected Learning and Computer-Based Modeling, Northwestern University, Evanston, IL.
Please cite the textbook as:
- Wilensky, U. & Rand, W. (2015). Introduction to Agent-Based Modeling: Modeling Natural, Social and Engineered Complex Systems with NetLogo. Cambridge, MA. MIT Press.
COPYRIGHT AND LICENSE
Copyright 2014 Uri Wilensky.
This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 License. To view a copy of this license, visit https://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
;; Brief Introduction of the idea of Heros and Cowards Model ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;; The “Heroes and Cowards” game, also called the “Friends and Enemies” game or the “Aggressors and Defenders” game dates back to the Fratelli Theater Group at ;; the 1999 Embracing Complexity conference, or perhaps earlier. ;; setup ;; each agent arbitrarily chooses another in the room to be their perceived friend, and another to be their perceived enemy. ;; setup ;; They don’t tell anyone who they have chosen, but they all move to position themselves either such that ;; Rules ;; they are between their friend and their enemy (BRAVE/DEFENDING), ;; Rules ;; they are behind their friend relative to their enemy (COWARDLY/FLEEING). ;; Purpose ;; Mostly it demonstrates how rich, complex, and surprising behavior can emerge from simple rules and interactions. ;; keywords : setxy random-xcor random-ycor ; set color one-of [ red blue ] ; personalities = "mixed" ; ;; globals, breeds, properties ---------------------------------------------- turtles-own [ friend enemy ] ;; an agent has two properties: a friend and an enemy to setup ;; build the world ---------------------------------------------------------- clear-all ;; clear the universe ask patches [ set pcolor white ] ;; ask the world to be white create-turtles number [ ;; create 'number' of agents, and ask each agent to do the following setxy random-xcor random-ycor ;; set each agent a random coordinate if (personalities = "brave") [ set color blue ] ;; if agent is brave, color it blue if (personalities = "cowardly") [ set color red ] ;; if agent is cowardly, color it red if (personalities = "mixed") [ set color one-of [ red blue ] ] ;; if agent is mixed, color it either color above set friend one-of other turtles ;; make a friend with one of other agents ; user-message (word "how many turtles left" count other turtles ) set enemy one-of other turtles ;; make an enemy with one of other agents (no replacement?) ] reset-ticks ;; put clock back to 0 end to go ;; running the world ---------------------------------------------------------- ask turtles [ ;; ask every agent to do the following if (color = blue) [ act-bravely ] ;; if the agent is brave (blue) , it behaves bravely if (color = red) [ act-cowardly ] ;; if the agent is a coward (red) , it behaves cowardly ] tick ;; the clock is ticking end to act-bravely ;; behaving bravely ---------------------------------------------------------- facexy ([xcor] of friend + [xcor] of enemy) / 2 ;; face toward x-coordintae of middle position between frend and enemy ([ycor] of friend + [ycor] of enemy) / 2 ;; face toward y-coordintae of middle position between frend and enemy fd 0.1 ;; move forward 0.1 unit distance end to act-cowardly ;; behaving cowardly ---------------------------------------------------------- facexy [xcor] of friend + ([xcor] of friend - [xcor] of enemy) / 2 ;; face toward x-coordintae of the position where friend is between agent and enemy [ycor] of friend + ([ycor] of friend - [ycor] of enemy) / 2 ;; face toward y-coordintae of the position where friend is between agent and enemy fd 0.1 ;; move forward 0.1 unit distance end to preset [ seed ] ;; preset initial states (a particular random seed ) of world or parameters -------------- set personalities "mixed" ;; all agents to be "mixed" set number 68 ;; total agent number to be 68 random-seed seed ;; use a particular random seed setup ;; then do the regular setup end to find-friend-enemy ;; find your friend and enemy ---------------------------------------------------------- ask one-of turtles [ ;; ask any one of the agents set size 2 set shape "person" ;; make it twice big and person-shape create-link-with enemy [ set color black ] ;; create a black link connect agent and enemy ask enemy [ set shape "enemy" set size 2 ] ;; ask enemy to be enemy-like and twice big create-link-with friend [ set color yellow ] ;; create a yellow link connecting agent and friend ask friend [ set shape "friend" set size 2 ] ;; ask friend to be friend-like and twice big ] end ; Copyright 2014 Uri Wilensky. ; See Info tab for full copyright and license.
There is only one version of this model, created almost 7 years ago by 深度碎片 Kenny.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Hero and Coward Updated.png | preview | Preview for 'Hero and Coward Updated' | almost 7 years ago, by 深度碎片 Kenny | Download |
This model does not have any ancestors.
This model does not have any descendants.