<< Chapter < Page Chapter >> Page >
Learn how to write a program that simulates the spread of a fatal communicable disease within a population.

Table of contents

Preface

This module is one in a collection of modules designed to teach you about the anatomy of a game engine.

Although the modules in this collection will concentrate on the Java game library named Slick2D, theconcepts involved and the knowledge that you will gain is applicable to different game engines written in different programming languages as well.

The purpose of this module is to teach you how to write a program that simulates the spread of a fatal communicable disease within a population (a pandemic) .

Viewing tip

I recommend that you open another copy of this module in a separate browser window and use the following links to easily find and view the imagesand listings while you are reading about them.

Figures

  • Figure 1 . The disease has gained a foothold.
  • Figure 2 . The disease has spread into the population.
  • Figure 3 . The disease has receded after killing many in the population.

Listings

Preview

In an earlier module titled Slick0210: Collision detection and sound , you learned how to write a non-trivial program involving thousands ofsprites, collision detection, and sound. We will take that concept considerably further in this module by writing a program that simulates thespread of a fatal communicable disease within a population (a pandemic) and displays the results in animated graphic form.

The disease has gained a foothold

Figure 1 shows the result of inserting a single infected sprite into a population of healthy sprites. Healthy sprites arecolored green and infected sprites are colored red.

By the time the screen shot in Figure 1 was taken, the disease had gained a foothold, several other sprites had become infected, andeight of the original 1000 sprites had died, leaving only 992 live sprites including the seven that are infected.

Figure 1 . The disease has gained a foothold.
Missing image.

The disease has spread into the population

Figure 2 shows the situation some time later when the disease has spread considerably. By this point, many sprites have becomeinfected (and are infecting others) and only 763 of the original 1000 sprites are still alive including those that are infected.

Figure 2 . The disease has spread into the population.
Missing image.

The disease has receded

Figure 3 shows the situation much later. For the set of properties used to run this simulation, the pandemic appears to be receding with 341 of the 1000 original spritesstill alive.

Questions & Answers

how did the oxygen help a human being
Achol Reply
how did the nutrition help the plants
Achol Reply
Biology is a branch of Natural science which deals/About living Organism.
Ahmedin Reply
what is phylogeny
Odigie Reply
evolutionary history and relationship of an organism or group of organisms
AI-Robot
ok
Deng
what is biology
Hajah Reply
cell is the smallest unit of the humanity biologically
Abraham
what is biology
Victoria Reply
what is biology
Abraham
HOW CAN MAN ORGAN FUNCTION
Alfred Reply
the diagram of the digestive system
Assiatu Reply
allimentary cannel
Ogenrwot
How does twins formed
William Reply
They formed in two ways first when one sperm and one egg are splited by mitosis or two sperm and two eggs join together
Oluwatobi
what is genetics
Josephine Reply
Genetics is the study of heredity
Misack
how does twins formed?
Misack
What is manual
Hassan Reply
discuss biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles
Joseph Reply
what is biology
Yousuf Reply
the study of living organisms and their interactions with one another and their environment.
Wine
discuss the biological phenomenon and provide pieces of evidence to show that it was responsible for the formation of eukaryotic organelles in an essay form
Joseph Reply
what is the blood cells
Shaker Reply
list any five characteristics of the blood cells
Shaker
Got questions? Join the online conversation and get instant answers!
Jobilize.com Reply

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Anatomy of a game engine. OpenStax CNX. Feb 07, 2013 Download for free at https://legacy.cnx.org/content/col11489/1.13
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Anatomy of a game engine' conversation and receive update notifications?

Ask