From Main and Savitch, Data Structures and other Objects using C++, 4th Ed. Section 14.2, "Simulation of an Ecosystem"