11.9 Summary
In this chapter, we designed and implemented a large, multiclass graphical simulation. First, we considered a description of the problem. We picked out the important subjects (nouns) and began to implement classes, one for each. Then, to design a class, we described those things that instances of a class would need to know about themselves (the instance variables) and those things that instances of a class would need to be able to do (the methods). After creating each class, we implemented a function that established many objects, and we let each object perform methods as defined by the initial rules of the simulation. By using random numbers, we were able to provide a degree of uncertainty so that no two runs of our simulation ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access