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! now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.