17. Conway’s Game of Life
How do you get to Carnegie Hall? Practice, practice! Now answer this: how do you become a programmer?
The answer is to practice on what I call “real projects.” That’s why I focused on Tic-Tac-Toe in Chapter 14. Playing a perfect strategy—even for this simple game—is far from trivial. It required serious mastery of Python fundamentals, as well as creative decision-making.
In this chapter, I’ll apply Python tricks introduced in the last few chapters to an even more ambitious project: Conway’s Game of Life, which simulates living cells! That this entire program can be written in 100 lines (38 if you take out the comments and blank lines!) is remarkable. The strategy of this chapter is
Develop a general-purpose matrix class ...
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