October 2019
Beginner to intermediate
498 pages
14h 13m
English
We will create our simulation in Python by first implementing the instance variables and methods of the classes as described previously. Once we have the classes in place, we can complete the simulation by simply creating a world, adding life-forms to it, and then allowing the life-forms to live. The longer we let the simulation run, the more interesting the results may become.
World ClassWe will begin by implementing the World class. Recall that the World class will maintain dimensions as well as a list of the life-forms that are present. It will also have a grid to track the life-form positions. A Turtle will be used to set the initial coordinates for the world and to draw the grid.
Implementation of the ...
Read now
Unlock full access