TITLE: Simulation of 6300 year intergalactic journey
AUTHORS: Thorsten Sommer

[DESCRIPTION]
<div class = "text-blocks"><div class = "text-block">This protocol describes a possible implementation of a simulation of a 6300 year journey from Earth to Proxima Centauri b. It is based on the description of Frédéric Marin and Camille Beluffi in their paper from 2018.</div><div class = "text-block">The assumption is that this is an agent-based simulation in which the agents consist of female and male crew members.</div></div>

[STEPS]
?. [Setup]
Reset: Reset i.e. clear the entire simulation.
?. [Setup]
Pens: Initialize all pens of both diagrams. This is necessary so that the user can choose between a simulation on a daily or monthly basis.
?. [Setup]
Capacity: Define the capacity of the spaceship so that a maximum of 500 people can live on it.
?. [Setup]
Import representation: Import the two-dimensional representation of the spaceship from the Spaceship.png file. This will also import the colors that indicate which risk zones exist where in the spaceship.
?. [Setup]
Create males: Creates the first half of the crew (males): Set males' color to blue. Define the date of death and the age of all males as the normal distribution with the parameters selected from the user interface. Define all males as fertile (all males were examined before the mission so that initially only fertile members are present).
?. [Setup]
Create females: Creates the second half of the crew (females): Set females' color to red. Define the date of death and the age of all females as the normal distribution with the parameters selected from the user interface. Define all females as fertile (all females were examined before the mission so that initially only fertile members are present). Determine how many children a female can have and when her menopause begins, both as normal distribution with the parameters selected in the user interface. Define that all females are not pregnant.
?. [Setup]
Fixing crew's age: Depending on the parameters selected in the user interface, it might happen that some crew members have a negative age due to the normal distribution of age. Therefore, this step ensures that the members affected by this effect receive an age between 0 and 365 days.
?. [Setup]
Random position: Assign a random position in the spaceship to each crew member.
?. [Setup]
Not in space: Make sure no crew member was randomly positioned outside the spacecraft.
?. [Setup]
Count sex: Count how many males and females currently exist and how many are fertile or infertile. This step is necessary to subsequently calculate the initial infertility as a distribution over the crew.
?. [Setup]
Determine mean age: Calculate the average age of the crew.
?. [Setup]
Crews' infertility: Randomly distribute the infertility status to the crew according to the parameters configured in the user interface.
?. [Setup]
Unfertile women cannot have children: This step ensures that women who are infertile cannot have children.
?. [Setup]
Count sex: Count how many males and females currently exist and how many are fertile or infertile. This step will now be performed again after the infertility status has been correctly distributed across the crew. This will give us statistics about the actual infertility at the start time of the mission.
?. [Setup]
Reset ticks: The ticks of the simulation are reset.
?. [Simulation procedure]
Check life: The first step is to check if and how many crew members die today. Everyone whose lifespan has expired is marked dead and is no longer part of the simulation. All members who do not die naturally today will become one day or month older.
The simulation runs in so-called ticks. Each tick corresponds to one day of the intergalactic journey. For each day i.e. tick, the steps 16 to 30 are run through until the simulation ends.
?. [Simulation procedure]
Check if accidents occur: It will be checked whether there will be an accident on the spaceship today. The statistical probability of an accident is 1%. If this probability applies, an accident occurs. It is also checked in which part of the spaceship the accident occurs. When an accident happens, it happens 70% in a black area, 20% in a dark area, 8% in a gray area, and 1% in the white area. The accidents in the black area end in 30%, in the dark area in 15%, in the grey area in 5%, and in the white area in 1% of the cases deadly. Depending on whether and where an accident occurs, appropriate crew members from the affected part of the ship are randomly selected and marked as dead. These members are then no longer part of the simulation.
?. [Simulation procedure]
Count sex: Count how many males and females currently exist and how many are fertile or infertile. This will update the mission's statistic after all natural and unnatural deaths have been addressed.
?. [Simulation procedure]
Mission ended? It will be checked if the mission has been completed. This is the case when the mission year 6300 has been reached. The survivors of the mission can then colonize the distant planet. If the number of crew members is above the capacity limit, the mission also ends: In this case the members starve, die of thirst or suffocate because the resources are not sufficient. The mission can also end when all humans on the ship are extinct.
?. [Simulation procedure]
Male actions: The actions of the males are limited to the fact that their agents move randomly in the spaceship.
?. [Simulation procedure]
Female actions: The females move first randomly in the spaceship. With all females that are pregnant, the pregnancy progresses by one or 30 day(s). Afterwards it is determined whether and how many births there will be today. The pregnancy of the affected females is terminated and the birth is initiated. For each birth it is statistically determined whether there will be twins. The probability of this is 1%. Then it is decided whether a male or female will be born. The probability is the same for both sexes. For each newborn the age is set to zero and the other parameters are assigned as in the setup (day of death, fertility, number of children, menopause, etc.) The newborns are added to the crew.
?. [Simulation procedure]
Mating: In this step it is first determined how many males are at the permitted age for reproduction. This number indicates the maximum number of theoretically possible reproductions for that day. If the option for dynamic control of allowed reproduction is enabled in the user interface, this number is dynamically reduced if necessary to prevent overpopulation on the spacecraft. If the capacity limit is reached to 80%, only 30% of the males are allowed to mate with a female. If the capacity limit was reached to 90%, only three males are allowed to mate with a female. If the capacity limit is already reached to 95% or more, no reproduction at all is permitted on this day. The number of males determined in this way is selected randomly. The selected males randomly select a suitable female. Suitable females are not yet pregnant, are in the age range for permitted reproduction and are younger than the time of menopause. Now it is checked whether both partners are fertile and the female has not yet exceeded her child limit. If all conditions are met, intercourse occurs. After that there is a 75% probability that the female has become pregnant. If this probability is fulfilled, the female is marked as pregnant.
?. [Simulation procedure]
Protection: This step ensures that all children younger than 17 years and all pregnant females are in the safest area of the spacecraft. This measure ensures that the highest mission priority is maintained (crew survival).
?. [Simulation procedure]
Not in space: Make sure no crew member was randomly positioned outside the spacecraft.
?. [Simulation procedure]
Count sex: Count how many males and females currently exist and how many are fertile or infertile. This will update the statistics after all births due for that day have been handled.
?. [Simulation procedure]
Determine mean age: Calculate the average age of the crew.
?. [Simulation procedure]
Determine year: Calculate the current mission year.
?. [Simulation procedure]
Update plots: The "Population over time (last 365 days)" diagram is updated. This cannot be done automatically because, so to speak, the window of the graph has to move, so that the last 365 days are always visible.
?. [Simulation procedure]
Time advancement: Depending on the configuration, the simulation progresses by one day or one month.
?. [Simulation procedure]