Simple population simulator for analyzing the effects of China's 1-child policy. Populations are grouped into ages with a bin size of 20 years, and the simulation runs 20 years per tick. At the end of running, it produces a simple population vs. time line chart to display the effects over time.
Simulation assumptions:
- No family can have more children than
childPolicyNum - If
childPolicyNumis greater than 1, not all families have the max amount of children, they instead have a random amount of kids within the bounds of 1 andchildPolicyNum - Not all people aged 20-40 ever have kids, this is controlled with the
percentHavingChildrenvariable - Death rates among different age bins are different, but constant, with
- moderate death rates for children (0-20) and middle age (40-60)
- lowest death rates for young adults (20-40)
- highest death rates for elderly (60-100)
- There are so few aged older than 100, that they are negligible in the total calculation, thus it is assumed that no one lives past age 100
- Male and female birth rates and death rates are equal (since it is always assumed that half of every population is half men and half women)
- python3
- npm
npm install
node app.js