AHEM - Ineritance Project
Do you have questions or comments about this model? Ask them here! (You'll first need to log in.)
WHAT IS IT?
This project is a simulation of a small town or population of 1000 that encounters a foreign virus. This virus targets traits like hair or eye color. I created this simulation in hopes of seeing a rough idea of what would occur to a poulation if they were to come across this virus, in case a similar pathogen were to break out in the future. This imulation strives to show how our population would be affected over time, and how our appearences would change out of necessity.
HOW IT WORKS
All people move randomly around their world. When a woman and a man are on the same patch of the world, they have a chance of coupling. Once they couple, they no longer move, and they have a chance to produce a child. The probability of becoming pregnant is based on a random variable compared against fertility rates and the desired age at which women in developed countries consider having children. Women in this model are most likely to get pregnant if coupled and at the age of 30.
The hair color of people's offspring is dependent on the parent's hair coloring. It's based on which traits are dominant to other traits, and helped decide the percentage chance for a child to have a certain hair color.
In this simulation, the maximum age is 100. Also, after each year the person has a random chance of death based on mortality rates from the Social Security Administration.
The simulation starts with an initial population of 1000, and you can use the population slider to designate a maximum population that this world can support. The simulation then randomly migrates people away until the population drops below the maximum.
In my simulation, there is a rampant infection spreading that will kill off people within a certain amount of years. This number is customizable using the years-until-death slider. The virus first spawns in with 10% of the population, and is spread by being at the same location as an infected person. This virus targets physical traits, or your appearence, and targets people with a combination of two traits that you can select.
If a person has both traits, they have a higher chance of infection (60%), and if they only have one trait, they have a much lower chance of infection (15%). If they do not have either of the traits in your selected combination, they have no chance to get infected.
HOW TO USE IT
To setup the simulation, press the button at the top named Reset Simulation. This will load an initial population of 1000 people. To run the simulation one year at a time, press the button named Go Once. To run it for an infinite amount of time, press Go Forever. This button also pauses the simulation.
REPRODUCING SIMULATIONS
Use the model-seed input to reproduce simulations.
THINGS TO NOTICE
Icons represent the gender, age group, and hair color of each person.
- Star = Female under 17
- Square = Female between 17 and 45
- Flower = Female older than 45
- Turtle = Male under 17
- Circle = Male betwen 17 and 65
- Bug = Male over 65
When a Woman is pregnant, her shape changes to a person.
When a person is infected, their shape changesd to a sad face.
THINGS TO TRY
One of the options to change in my simulation is to press Stop When. This will give you the option to choose out of three choices: None, if you want it to go until you manually stop it; Population = 0, if you want to run the simulation until all people are dead; or Infected = 0, if you want to run the simulation until all infected persons are dead.
Another thing to change is the Maximum Population slider. With this, you can designate the maximum number of people who can live in this area at any time.
The Years Until Death slider designates the amount of time the infected have left to live before they die due to complications with their illness. Note how a longer Years Until Death value requires a much longer period for the virus to be eradicated as it has more time to spread to more of the population.
In this simulation, you can also choose which combination of traits is most likely to be infected. You can do this by clicking on the chooser titled Hair Eye Combo. If you want to run this simulation without any infected, you can choose to do so as well.
The last option to change about this simulation is to designate the amount of time the simulation runs for. You can do this by enering a number into the input box labelled Max Time. you can also choose to leave this box blank if you wish to see this simulation run indefinetely.
One thing that you can do in this simulation as an additional feature is view an individual person. You can do this by selecting the person you wish to follow, press Inspect to view their traits and other details, or press Watch to see them move around the map.
EXTENDING THE MODEL
Many variables in this simulation had to be simplified. For example, once a couple is formed, they stay together until one of the couple dies. Also, hair color inheritance is not only determined by the hair color of their parents. All pregnancies in this model result in a successful birth. I also only included heterosexual relationships.
CREDITS AND REFERENCES
- Death probabilities: https://www.ssa.gov/oact/STATS/table4c6.html
- Desire for children: https://pmc.ncbi.nlm.nih.gov/articles/PMC9619608/
- Fertility rates at different ages: https://www.babycenter.com/getting-pregnant/preparing-for-pregnancy/chart-the-effect-of-age-on-fertility_6155
The base population (in terms of ages and genders in particular) was modelled after the Renton, Washington population in 2020 as this city had 100,000 people in that year's Census, and it would be easy to scale down to a population of 1000. Demographic characteristics were taken from https://en.wikipedia.org/wiki/Renton,_Washington
Comments and Questions
extensions [ csv ] globals [ grim-multiplier fertility-chance population total-men total-women hair-red hair-black hair-brown hair-blonde red-pct black-pct brown-pct blonde-pct eyes-blue eyes-brown eyes-brown-pct eyes-blue-pct total-infected male-infected female-infected infected-pct ] breed [ men man ] breed [ women woman ] men-own [ eyes hair age gender coupled? partner f-hair f-eyes mother infected? infectable? time-left ] women-own [ eyes hair age gender coupled? partner f-hair f-eyes o-hair pregnant? mother infected? infectable? time-left ] to setup clear-all random-seed model-seed setup-men setup-women assign-shape set grim-multiplier [ 0.0004 0.0003 0.0002 0.0002 0.0002 0.0001 0.0001 0.0001 0.0001 0.0001 0.0001 0.0002 0.0002 0.0003 0.0004 0.0006 0.0009 0.0011 0.0013 0.0014 0.0015 0.0016 0.0017 0.0018 0.0020 0.0021 0.0022 0.0023 0.0025 0.0026 0.0027 0.0028 0.0029 0.0030 0.0031 0.0032 0.0033 0.0034 0.0036 0.0038 0.0040 0.0041 0.0043 0.0045 0.0048 0.0051 0.0054 0.0058 0.0062 0.0067 0.0072 0.0077 0.0084 0.0090 0.0098 0.0106 0.0114 0.0123 0.0132 0.0143 0.0154 0.0165 0.0176 0.0188 0.0199 0.0211 0.0224 0.0238 0.0254 0.0271 0.0290 0.0312 0.0338 0.0367 0.0406 0.0443 0.0485 0.0532 0.0588 0.0646 0.0709 0.0778 0.0857 0.0948 0.1051 0.1166 0.1293 0.1427 0.1576 0.1745 0.1930 0.2129 0.2327 0.2518 0.2709 0.2898 0.3080 0.3254 0.3417 0.3587 0.3767 0.3955 0.4153 0.4361 0.4579 0.4808 0.5048 0.5300 0.5565 0.5844 0.6136 0.6443 0.6765 0.7103 0.7458 0.7831 0.8223 0.8634 0.9065 ] set fertility-chance [ 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00137 0.00137 0.00137 0.00137 0.00137 0.01555 0.01555 0.00777 0.06219 0.16434 0.20759 0.21624 0.48438 0.21350 0.94770 0.15175 0.37076 0.16861 0.13139 0.18066 0.02464 0.02201 0.02201 0.00734 0.01839 0.00307 0.00307 0.00307 0.00613 0.00613 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 0.00000 ] ask patches [ set pcolor white ] reset-ticks count-globals initialize-infection end to initialize-infection set total-infected 0 ask turtles [ set infected? false set time-left 100 set infectable? false ] infect end to count-globals set total-men ( count men ) set total-women ( count women ) set population ( total-men + total-women ) set hair-black ( count men with [ hair = "black" ] + count women with [ hair = "black" ] ) set hair-brown ( count men with [ hair = "brown" ] + count women with [ hair = "brown" ] ) set hair-blonde ( count men with [ hair = "yellow" ] + count women with [ hair = "yellow" ] ) set hair-red ( count men with [ hair = "red" ] + count women with [ hair = "red" ] ) set eyes-blue ( count men with [ eyes = "blue" ] + count women with [ eyes = "blue" ] ) set eyes-brown ( count men with [ eyes = "brown" ] + count women with [ eyes = "brown" ] ) if population > 0 [ set black-pct ( hair-black / population * 100 ) set brown-pct ( hair-brown / population * 100 ) set blonde-pct ( hair-blonde / population * 100 ) set red-pct ( hair-red / population * 100 ) set eyes-brown-pct ( eyes-brown / population * 100 ) set eyes-blue-pct ( eyes-blue / population * 100 ) ] end ;;; WHEN GO IS PRESSED: to go count-globals assign-shape set male-infected count men with [ infected? ] set female-infected count women with [ infected? ] set total-infected ( male-infected + female-infected ) set infected-pct ( total-infected / population * 100 ) ask men [ overpopulation if age > 100 [ die ] ; for simplicity, if older than 100, die uncouple if not coupled? [ move ] ; move grim-reaper ] ask women [ overpopulation if age > 100 [ die ] ; for simplicity, if older than 100, die uncouple if not coupled? [ move ] ; move make-couple pregnancy grim-reaper ] ask turtles with [ infected? ] [ transmit-infection ifelse time-left = 0 [ die ] [set time-left ( time-left - 1 ) ] set shape "face sad" ] if stop-when = "Population = 0" [ if population = 0 [ stop ] ] if stop-when = "Total Infected = 0" [ if total-infected = 0 [ stop ] ] if ticks = max-time [ stop ] tick end to setup-men create-men 500 [ setxy random-xcor random-ycor set coupled? false set partner nobody set age ( 5 + ( random (75 - 5) + 1 ) ) set gender "M" assign-haircolor assign-eyecolor ] end to setup-women create-women 500 [ setxy random-xcor random-ycor set coupled? false set partner nobody set age ( 5 + ( random (75 - 5) + 1 ) ) set gender "F" assign-haircolor assign-eyecolor set pregnant? false ] end to assign-haircolor let x random-float 1.0 if x <= 1.0 [ set hair "red" set color red ] if x <= 0.989 [ set hair "yellow" set color yellow ] if x <= 0.965 [ set hair "brown" set color brown ] if x <= 0.855 [ set hair "black" set color black ] end to assign-eyecolor let x random 100 + 1 if x <= 100 [ set eyes "blue" ] if x <= 59 [ set eyes "brown" ] end to assign-shape ask men [ set shape ( ifelse-value age <= 16 [ "turtle" ] age >= 65 [ "bug" ] [ "circle" ]) ] ask women [ set shape ( ifelse-value age <= 16 [ "star" ] age >= 46 [ "flower" ] [ "square" ]) ] end to move rt random-float 360 fd random 5 + 1 end to grim-reaper let idx ( age - 1 ) ; we need this for indexing let comparison ( item idx grim-multiplier ) ; find the death probability let grim random-float 1.0 ; generate a random float; if the death probability ifelse comparison > grim [ die ] [ set age ( age + 1 ) ] ; is greater, die; else grow older one year end to pregnancy ifelse pregnant? [ make-child set shape "square" ] [ let idx ( age - 1 ) let comparison ( item idx fertility-chance ) let fertile random-float 1.0 if comparison > fertile and coupled? [ set pregnant? true set shape "person" ] ] end to make-child let set-gender one-of [1 -1] if set-gender = 1 [ hatch-men 1 [ set shape "circle" set age 1 set gender "M" set partner nobody set coupled? false set infected? false ask myself [ haircolor eyecolor ] ] ] if set-gender = -1 [ hatch-women 1 [ set shape "square" set age 1 set gender "F" set partner nobody set coupled? false set infected? false ask myself [ haircolor eyecolor ] ] ] set pregnant? false end to make-couple let potential-partner one-of men-here with [ not coupled? and age > 16 ] if potential-partner != nobody [ set partner potential-partner set coupled? true set f-hair ( [ hair ] of potential-partner ) set f-eyes ( [ eyes ] of potential-partner ) ask partner [ set coupled? true ] ask partner [ set partner myself ] move-to patch-here ask potential-partner [ move-to patch-here ] set pcolor gray - 3 ask ( patch-here ) [ set pcolor gray - 3 ] ] end to transmit-infection let potential-host one-of turtles-here with [ not infected? ] if potential-host != nobody [ if ( [ hair ] of potential-host ) = ( [ hair ] of self ) and ( [ eyes ] of potential-host ) = ( [ eyes ] of self ) [ let transmit random 100 if transmit < 60 [ ask potential-host [ set infected? true set time-left years-until-death ] ] ] if ( [ hair ] of potential-host ) = ( [ hair ] of self ) or ( [ eyes ] of potential-host ) = ( [ eyes ] of self ) [ let transmit random 100 if transmit < 15 [ ask potential-host [ set infected? true set time-left years-until-death ] ] ] ] end to uncouple if partner = nobody [ set coupled? false ] set pcolor white ask ( patch-here ) [ set pcolor white ] end to overpopulation if population > max-population [ let migrate random 100 if migrate = 1 [ die ] ] end to haircolor ask myself [ let hair1 [ hair ] of self let hair2 [ f-hair ] of self if ( hair1 = "black" and hair2 = "black" ) or ( hair2 = "black" and hair1 = "black" ) [ let tmpvar ( random 8 + 1 ) let hairtype ( ifelse-value tmpvar = 1 [ "yellow" ] tmpvar = 2 [ "red" ] [ "black" ]) set hair hairtype set color read-from-string hairtype ] if ( hair1 = "black" and hair2 = "yellow" ) or ( hair2 = "black" and hair1 = "yellow" ) [ set hair "black" set color black ] if ( hair1 = "black" and hair2 = "red" ) or ( hair2 = "black" and hair1 = "red" ) [ let tmpvar ( random 4 + 1 ) let hairtype ( ifelse-value tmpvar = 1 [ "red" ] [ "black" ]) set hair hairtype set color read-from-string hairtype ] if ( hair1 = "black" and hair2 = "brown" ) or ( hair2 = "black" and hair1 = "brown" ) [ let tmpvar ( random 8 + 1 ) let hairtype ( ifelse-value tmpvar = 1 [ "yellow" ] tmpvar = 2 [ "red" ] tmpvar = 3 [ "black" ] [ "brown" ]) set hair hairtype set color read-from-string hairtype ] if ( hair1 = "yellow" and hair2 = "yellow" ) or ( hair2 = "yellow" and hair1 = "yellow" ) [ set hair "yellow" set color yellow ] if ( hair1 = "yellow" and hair2 = "red" ) or ( hair2 = "yellow" and hair1 = "red" ) [ set hair "yellow" set color yellow ] if ( hair1 = "yellow" and hair2 = "brown" ) or ( hair2 = "yellow" and hair1 = "brown" ) [ let tmpvar one-of [1 -1] ifelse tmpvar = 1 [ set hair "yellow" set color yellow ] [ set hair "brown" set color brown ] ] if ( hair1 = "brown" and hair2 = "red" ) or ( hair2 = "brown" and hair1 = "red" ) [ let tmpvar one-of [1 -1] ifelse tmpvar = 1 [ set hair "brown" set color brown ] [ set hair "red" set color red ] ] if ( hair1 = "brown" and hair2 = "brown" ) or ( hair2 = "brown" and hair1 = "brown" ) [ let tmpvar ( random 8 + 1 ) let hairtype ( ifelse-value tmpvar = 1 [ "yellow" ] tmpvar = 2 [ "red" ] [ "brown" ]) set hair hairtype set color read-from-string hairtype ] if ( hair1 = "red" and hair2 = "red" ) or ( hair2 = "red" and hair1 = "red" ) [ set hair "red" set color red ] ] end to eyecolor ask myself [ let eyes1 [ eyes ] of self let eyes2 [ f-eyes ] of self if ( eyes1 = "brown" and eyes2 = "brown" ) or ( eyes2 = "brown" and eyes1 = "brown" ) [ let tmpvar ( random 8 + 1 ) let eyetype ( ifelse-value tmpvar = 1 [ "blue" ] [ "brown" ]) set eyes eyetype ] if ( eyes1 = "blue" and eyes2 = "blue" ) or ( eyes2 = "blue" and eyes1 = "blue" ) [ set eyes "blue" ] if ( eyes1 = "blue" and eyes2 = "brown" ) or ( eyes2 = "blue" and eyes1 = "brown" ) [ let tmpvar ( random 4 + 1 ) let eyetype ( ifelse-value tmpvar = 1 [ "blue" ] [ "brown" ]) set eyes eyetype ] ] end to infect if hair-eye-combo = "Black Hair, Blue Eyes" [ let m-potential-infect men with [ hair = "black" or eyes = "blue" ] let f-potential-infect women with [ hair = "black" or eyes = "blue" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Brown Hair, Blue Eyes" [ let m-potential-infect men with [ hair = "brown" or eyes = "blue" ] let f-potential-infect women with [ hair = "brown" or eyes = "blue" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Blonde Hair, Blue Eyes" [ let m-potential-infect men with [ hair = "yellow" or eyes = "blue" ] let f-potential-infect women with [ hair = "yellow" or eyes = "blue" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Red Hair, Blue Eyes" [ let m-potential-infect men with [ hair = "red" or eyes = "blue" ] let f-potential-infect women with [ hair = "red" or eyes = "blue" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Black Hair, Brown Eyes" [ let m-potential-infect men with [ hair = "black" or eyes = "brown" ] let f-potential-infect women with [ hair = "black" or eyes = "brown" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Brown Hair, Brown Eyes" [ let m-potential-infect men with [ hair = "brown" or eyes = "brown" ] let f-potential-infect women with [ hair = "brown" or eyes = "brown" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Blonde Hair, Brown Eyes" [ let m-potential-infect men with [ hair = "yellow" or eyes = "brown" ] let f-potential-infect women with [ hair = "yellow" or eyes = "brown" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] if hair-eye-combo = "Red Hair, Brown Eyes" [ let m-potential-infect men with [ hair = "red" or eyes = "brown" ] let f-potential-infect women with [ hair = "red" or eyes = "brown" ] let m-tgt ( round ( total-men * 0.1 )) let f-tgt ( round ( total-women * 0.1 )) ask m-potential-infect [ set infectable? true ] ask f-potential-infect [ set infectable? true ] ask n-of m-tgt m-potential-infect [ set infected? true set time-left years-until-death ] ask n-of f-tgt f-potential-infect [ set infected? true set time-left years-until-death ] set total-infected ( count men with [ infected? ] + count women with [ infected? ] ) ] end
There is only one version of this model, created about 1 month ago by A Mahto.
This model does not have any ancestors.
This model does not have any descendants.