Welcome, for fun (or despair) we will write a program in Scratch to indicate real-time world population changes…increase or decrease. At the current rate, based on data, it’s growing…the net population is ever-increasing. However, this is a real-time world population simulation…simulation. The data is based on CIA World Factbook but the data are NOT connected live to their services. Just the parameters over some observed time are used (e.g. birth/death rates, etc.) and not meant to be statistically correct, rather a rough visual of the world population.
We pivot at a starting population number (which is easily updated in the code anytime, albeit not automatically from World Factbook. If you want a bit more statistically correct implementation, you can’t do this in Scratch, it’s beyond it’s capabilities and the scope of this blog, but feel free to check out https://worldbirthsanddeaths.com/ )…which is very close to official number at the time of writing.
So, based on that, we look at the changes in population about every second. Also, observing the birth and death rates from actual CIA data, we realize that it varies but not too drastically at this time, so I gave both rates reasonable ranges from which we “randomly” pick the parameters every loop.
The ball in the middle starts out a specific size but grows in size as the population grows (or shrinks if pop went down). The color hue changes are just for attention and so is the backdrop. The other numbers on screen are updated about every second. Once you close the page or quit, and restart, it’ll start from the starting population…which is in the code, as mentioned above, as a variable that can be programmatically changed to start new calculation. This value is NOT stored on the cloud, so every time each person from around the world runs it, the starting point will be where I coded it. The reason is mainly because users will need to log in to Scratch accounts to access this app if it required that cloud dependency, and it’s not my objective of this app. The objective is to show calculations and object manipulations, not actual population data.
Video Clip of GamePlay:
The Source Code, Playtime!
Code is pretty explanatory and is available when you run the app in your browser here: https://scratch.mit.edu/projects/280312344/