O'Reilly logo

Python Without Fear, First Edition by Brian Overland

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required