Hero and Coward Updated

Hero and Coward Updated preview image

1 collaborator

Tags

(This model has yet to be categorized with any tags)
Visible to everyone | Changeable by everyone
Model was written in NetLogo 6.0.4 • Viewed 188 times • Downloaded 11 times • Run 0 times
Download the 'Hero and Coward Updated' modelDownload this modelEmbed this model

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


Info tab cannot be displayed because of an encoding error

Comments and Questions

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

Click to Run Model

;; 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 over 5 years ago by 深度碎片 Kenny.

Attached files

File Type Description Last updated
Hero and Coward Updated.png preview Preview for 'Hero and Coward Updated' over 5 years ago, by 深度碎片 Kenny Download

This model does not have any ancestors.

This model does not have any descendants.