Fads And Fashions Three Choices
WHAT IS IT?
A three-choice polling game where turtles choose a color based upon the color of turtles they have encountered. The various majority and minority buttons start the turtles on paths to become either part of the majority colored turtles or the minority. The criteria used for the decision to change differs between "majority-max" and "majority-most".
Majority-max rule: Turtles change color (if change is necessary) after decision-time meetings, to the color of the turtles met most often (or least often for minority). In case of a color tie between the most turtles counted at the meetings, majority-max will flip a coin to decide which color to go with.
Majority-most rule: Turtles change color (if change is necessary) after decision-time meetings, to the color of the turtles met that represents a clear majority (greater than 50%) of the colors met.
Minority rule: Turtles change color (if change is necessary) after decision-time meetings, to the color of the turtles met least often. In case of a color tie between the most turtles counted at the meetings, minority will flip a coin to decide which color to go with.
HOW TO USE IT
"total-turtles" controls the number of turtles created. "prop-red", "prop-green", and "prop-violet" control the relative proportions of the three colors. "decision-time" controls the number of meetings after which a turtle will decide to change color or not. "wiggle-angle" sets the maximum random angle of side-to-side "wiggling" turtles will do as they walk. "rt-bias" and "lt-bias" bias the direction walked by each turtle by a number of degrees right or left. Click the setup-random button to setup agents randomly using the user-defined values. Setup-random creates as proportions of turtles as specified by the color proportion sliders, but with some randomness built in to the exact numbers calculated for each proportion. Click the setup-fixed button to setup agents using the exact proportion derived from the user-defined values: prop-red, prop-green, and prop-violet. Setup-fixed creates as exact proportions of turtles as specified by the color proportion sliders as is possible. Click the minority button to run the simulation using the minority rule Click the majority-max button to run the simulation using the majority-max rule Click the majority-most button to run the simulation using the majority-most rule Click the Graph-it button to activate the graphing. Click stopall to stop the program.
THINGS TO NOTICE
Watch the plot to see how populations of red and green turtles change over time. You can also watch the reds and greens monitors to see how the values change over time. Be sure to look at both the Plot Window and the 2D representation of the color distribution. What are the effects of clustering on the system over time? Why does clustering occur?
EXPLORATIONS
Try setting right-bias to 30 degrees, wiggle-angle to 10 degrees, the population to around 500, the proportions to 2:2:1, and try each of the majority and minority buttons for ten or fifteen minutes. Try this again without a bias. Set two of the colors in equal proportions, but the third much higher or lower. When running the majority-1 game with the population of two colors higher than the third, what relationship do you notice (1) between the two higher colors, and (2) between the pair of two higher colors and the third? What is the influence of a high right or left bias? Be sure to look at both the
Turtle procedures
turtles-own [
numred ; number of reds encountered
numgreen ; number of greens encountered
numviolet ; number of violets encountered
]
;; wiggle procedure
;; called by the minority, majority-max, and majority-most procedures
;; Turtles move by turning right by a random amount less than wiggle-angle plus a
;; fixed right-bias and turning left by a random amount less than wiggle-angle
;; plus a fixed left-bias amount. Then the turtle takes one step forward.
;;
to wiggle
rt ((random wiggle-angle) + right-bias)
lt ((random wiggle-angle) + left-bias)
fd 1
end
;; minority procedure
;; called by the minority button
;; The turtle moves then grabs a partner on the same patch, the number of reds, greens or
;; violets encountered gets incremented depending on the color of the partner. If the
;; sum of the encounters equals the decision-time set by the user, it is time to make
;; a decision on what color to become. The turtle becomes the color of the least frequently
;; met color of turtle. If there is a tie between two colors, randomly choose one. After
;; choosing, reset the counts of encounters to 0 and check to see if all the turtles are
;; now one color, if so, end the program.
;;
to minority
wiggle
grab one-of-turtles-here [
case (color-of partner) [
red [setnumred numred + 1]
green [setnumgreen numgreen + 1]
violet [setnumviolet numviolet + 1]
]
if (numred + numgreen + numviolet) = decision-time [
case (min (min numred numgreen) numviolet) [
numred
[
ifelse numred = numgreen [ifelse ((random 2) = 1) [setc red] [setc green]] [setc red]
ifelse numred = numviolet [ifelse ((random 2) = 1) [setc red] [setc violet]] [setc red]
]
numgreen
[
ifelse numgreen = numred [ifelse ((random 2) = 1) [setc green] [setc red]] [setc green]
ifelse numgreen = numviolet [ifelse ((random 2) = 1) [setc green] [setc violet]] [setc green]
]
numviolet
[
ifelse numviolet = numgreen [ifelse ((random 2) = 1) [setc violet] [setc green]] [setc violet]
ifelse numviolet = numred [ifelse ((random 2) = 1) [setc violet] [setc red]] [setc violet]
]
] ; end case
setnumred 0
setnumgreen 0
setnumviolet 0
] ; end if
] ; end grab
if (count-color red) = count-turtles
or (count-color green) = count-turtles
or (count-color violet) = count-turtles
[stopall]
end
;; majority-max procedure
;; called by the majority-max button
;; The turtle moves then grabs a partner on the same patch, the number of reds, greens or
;; violets encountered gets incremented depending on the color of the partner. If the
;; sum of the encounters equals the decision-time set by the user, it is time to make
;; a decision on what color to become. The turtle becomes the color of the most frequently
;; met color of turtle. If there is a tie between two colors, randomly choose one. After
;; choosing, reset the counts of encounters to 0 and check to see if all the turtles are
;; now one color, if so, end the program.
;;
to majority-max
wiggle
grab one-of-turtles-here [
case (color-of partner) [
red [setnumred numred + 1]
green [setnumgreen numgreen + 1]
violet [setnumviolet numviolet + 1]
]
if (numred + numgreen + numviolet) = decision-time [
case (max (max numred numgreen) numviolet) [
numred
[
ifelse numred = numgreen [ifelse ((random 2) = 1) [setc red] [setc green]] [setc red]
ifelse numred = numviolet [ifelse ((random 2) = 1) [setc red] [setc violet]] [setc red]
]
numgreen
[
ifelse numgreen = numred [ifelse ((random 2) = 1) [setc green] [setc red]] [setc green]
ifelse numgreen = numviolet [ifelse ((random 2) = 1) [setc green] [setc violet]] [setc green]
]
numviolet
[
ifelse numviolet = numgreen [ifelse ((random 2) = 1) [setc violet] [setc green]] [setc violet]
ifelse numviolet = numred [ifelse ((random 2) = 1) [setc violet] [setc red]] [setc violet]
]
] ; end case
setnumred 0
setnumgreen 0
setnumviolet 0
] ; end if
] ; end grab
if (count-color red) = count-turtles
or (count-color green) = count-turtles
or (count-color violet) = count-turtles
[stopall]
end
;; majority-most procedure
;; called by the majority-most button
;; The turtle moves then grabs a partner on the same patch, the number of reds, greens or
;; violets encountered gets incremented depending on the color of the partner. If the
;; sum of the encounters equals the decision-time set by the user, it is time to make
;; a decision on what color to become. The turtle becomes the color of the most frequently
;; met color of turtle only if that color turtle was encountered more than the other two
;; color turtles combined. After choosing a color (or remaining the same color), reset
;; the counts of encounters to 0 and check to see if all the turtles are now all
;; one color, if so, end the program.
;;
to majority-most
wiggle
grab one-of-turtles-here [
case (color-of partner) [
red [setnumred numred + 1]
green [setnumgreen numgreen + 1]
violet [setnumviolet numviolet + 1]
]
if (numred + numgreen + numviolet) = decision-time [
if numred > numgreen + numviolet [setc red] ; Change only if a majority
if numgreen > numred + numviolet [setc green]
if numviolet > numgreen + numred [setc violet]
setnumred 0
setnumgreen 0
setnumviolet 0
]
]
if (count-color red) = count-turtles
or (count-color green) = count-turtles
or (count-color violet) = count-turtles
[stopall]
end
Observer procedures
globals [
interface-sum ; sum of prop-red + prop-green + prop-violet
reds ; number of reds
greens ; number of greens
violets ; number of violets
]
;; setup-random-prop procedure
;; called by the setup-random button
;; First calculate the percentages of red, green and violet as parts per 100
;; using the values defined by the user on sliders prop-red, prop-green and
;; prop-violet. Then for each turtle, randomly choose a number between 0 - 100.
;; if the number falls within the range 0 - (greens-1) -> make the turtle green
;; else if the number falls within the range greens - (reds+greens-1) -> make it red
;; else make it violet. Give the turtle a random position.
;; Finally set up the graph.
;;
to setup-random-prop
ca
crt total-turtles
set interface-sum (prop-red + prop-green + prop-violet)
set reds (100 * prop-red / interface-sum)
set greens (100 * prop-green / interface-sum)
set violets (100 * prop-violet / interface-sum)
ask-turtles [
let [:id (random 101)] ; setup a local variable called :id
ifelse (:id < greens)
[setc green]
[ifelse (:id >= greens) and (:id < (reds + greens))
[setc red]
[setc violet]
]
setxy random screen-width random screen-height
]
setup-graph
end
;; setup-fixed-prop procedure
;; called by the setup-fixed button
;; First calculate the number of red, green and violet turtles using
;; the values defined by the user on sliders prop-red, prop-green, prop-violet
;; and the value for totalturtles.
;; Then for each turtle,
;; if who falls within the range 0 - reds -> make the turtle red
;; else if who falls within the range (reds) - (reds+greens-1) -> make it green
;; else make it violet. Give the turtle a random position.
;; Finally set up the graph.
;;
to setup-fixed-prop
ca
crt total-turtles
set interface-sum (prop-red + prop-green + prop-violet)
set reds (prop-red / interface-sum) * total-turtles
set greens (prop-green / interface-sum) * total-turtles
set violets (prop-violet / interface-sum) * total-turtles
ask-turtles [
ifelse who < (reds)
[setc red]
[
ifelse who >= (reds) and who < (reds + greens)
[setc green]
[setc violet]
]
setxy random screen-width random screen-height
]
setup-graph
end
;; setup-graph procedure
;; called by setup-fixed-prop and setup-random-prop procedures
;; Sets up the graph: its title, axes, and colors for the lines.
;;
to setup-graph
pp 1 ppreset setppc red
pp 2 ppreset setppc green
pp 3 ppreset setppc violet
setplot-title "Red, Green, or Violet?"
setplot-yrange 0 100
setplot-xrange 0 100
viewplot
end
;; graph-it procedure
;; called by the graph-it button
;; Graph the number in each population: reds, greens, and violets.
;;
to graph-it
pp 1 ppd plot count-color red
pp 2 ppd plot count-color green
pp 3 ppd plot count-color violet
end
