10

Conway’s Game of Life on a Torus

In Chapter 3, we implemented Conway’s Game of Life using Python and the matplotlib library. You may recall one interesting aspect of that project: it used toroidal boundary conditions. Figure 3-2 on page 48 showed how we were effectively treating the flat, 2D grid of the simulation as a 3D toroidal surface, thanks to how the boundary conditions stitched the edges together. In the previous chapter, you were introduced to OpenGL and learned how to render 3D objects. Let’s now put together your experience with the Game of Life and OpenGL to re-create the Conway’s simulation in 3D, on an actual torus.

In this ...

Get Python Playground, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.