Chapter 24. Computer Simulations

Have you ever seen a “virtual pet”: those little toys with a small display screen and a few buttons for feeding your pet when it’s hungry, letting it sleep when it’s tired, playing with it when it’s bored, and so on? The virtual pet has some of the same characteristics as a real, live pet. That’s an example of a computer simulation—the virtual pet device is a tiny computer.

In the last chapter, we learned about random events and how to generate them in a program. In a way, that was a kind of simulation. A simulation is where you create a computer model of something from the real world. We created computer models of coins, dice, and decks of cards.

In this chapter, we’ll learn more about using computer programs ...

Get Hello World! Computer Programming for Kids and Other Beginners now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.