Pursuit of Happiness
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT DOES THIS SHOW?
This model shows how happines is influenced by light. More light makes people happy; less light makes them sad.
HOW IT WORKS
In this model, the level of light influences several factors. It determines the overall level of happiness, how fast happiness is lost, how people interact, and how much they move.
Happy people are colored green. Sad people are colored blue.
HOW TO USE IT
1) set the number of people in the model using the "number" slider 2) press the "gogosetup" button to initialize the light sensor 3) press the "setup" button to setup the onscreen model 4) press the "go" button to begin the similation 5) cover or uncover the light sensor to see how people respond to varying levels of light
Alternately, the light level can be adjusted by the "light" slider.
THINGS TO NOTICE
Watch what the people do when it is light and dark. Notice how the levels of happy and sad people change. Notice how they move and interact with each other.
THINGS TO TRY
Try covering the light sensor for longer and shorter periods of time. How long does it take for all the people to become sad? How long does it take for all of them to become happy?
EXTENDING THE MODEL
Right now there are only two colors for night and day. This could be extended to have an incremental scale so the color changes more subtlely.
This model takes one input, a light sensor. However, it could also readily take more inputs (temperature sensor, humdity sensor, etc.), which could influence the turtles happiness.
Comments and Questions
extensions [gogo] turtles-own [happy? antihappy? antiunhappy? happiness] Globals [ percent-sad serial-port] to gogosetup ifelse length (gogo:ports) > 0 [ set serial-port user-one-of "Select a port:" gogo:ports ] [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model" stop ] gogo:open serial-port repeat 5 [ if not gogo:ping [ user-message "There is a problem with the connection. Check if the board is on, and if the cable is connected. Otherwise, try to quit NetLogo, power cycle the GoGo Board, and open NetLogo again. For more information on how to fix connection issues, refer to the NetLogo documentation or the info tab of this model"] ] gogo:talk-to-output-ports [ "a" "b" "c" "d"] end to setup clear-all set-default-shape turtles "person" ask n-of number patches [ sprout 1 [set color blue]] ask n-of (number / 2) turtles [set color green] light-initial setup-happiness setup-unhappiness setup-anti reset-ticks end to light-initial ifelse gogo:sensor 1 > 500 [ask turtles [set happiness 20]] [ask turtles [set happiness 40]] end to check-light ifelse gogo:sensor 1 < 500 [ask turtles [set happiness happiness + random 10] ask patches [set pcolor 89]] [ask turtles [set happiness happiness - random 10] ask patches [set pcolor 0]] end to setup-happiness ask turtles with [color = green] [set happy? true] end to setup-unhappiness ask turtles with [color = blue] [set happy? false] end to setup-anti ask turtles [set antihappy? false] ask turtles [set antiunhappy? false] end to go move pass-on-happiness keep-on-happiness pass-on-unhappiness if gogo:sensor 1 >= 800 [fast-happy-fade check-light update-globals] if (gogo:sensor 1 > 500) and (gogo:sensor 1 < 800) [normal-happy-fade check-light update-globals] if gogo:sensor 1 <= 500 [slow-happy-fade check-light update-globals] tick ;update-globals end to move ifelse gogo:sensor 1 >= 600 [ask turtles [rt random 360 fd 0.5]] [ask turtles [rt random 360 fd 1]] end to pass-on-happiness ask turtles with [happy?] [ask other turtles-here with [not happy?] [happy-gain]] end to keep-on-happiness ask turtles with [happy?] [ask other turtles-here with [happy?] [keep-happy]] end to pass-on-unhappiness ask turtles with [not happy?] [ask other turtles-here with [not happy?] [keep-sad]] end to set-mood ifelse happiness > 20 [set happy? true set color green] [set happy? false set color blue] end to keep-happy happy-gain set antiunhappy? true end to keep-sad set antihappy? true end to slow-happy-fade ask turtles with [happy?] [if antiunhappy? [if happiness >= 20 [set happiness happiness - 1] ]] ask turtles [set-mood] end to normal-happy-fade ask turtles with [happy?] [if not antihappy? [if not antiunhappy? [if happiness >= 20 [set happiness happiness - 2] ]]] ask turtles [set-mood] end to fast-happy-fade ask turtles with [happy?] [if antihappy? [if happiness >= 20 [set happiness happiness - 3] ]] ask turtles [set-mood] end to happy-gain set happiness happiness + 1 end to update-globals set percent-sad (count turtles with [not happy?]) / (count turtles) * 100 end ;IF happiness 40 ;if happy. >40 ;set happy happy -1 ;if happy < 20 ;sad ;end ;if random 100< 20 [get sad]
There is only one version of this model, created over 12 years ago by Jacob Wilkes.
Attached files
File | Type | Description | Last updated | |
---|---|---|---|---|
Pursuit of Happiness.png | preview | Preview for 'Pursuit of Happiness' | over 12 years ago, by Jacob Wilkes | Download |
This model does not have any ancestors.
This model does not have any descendants.