Popular recipes tagged "life" but not "of"http://code.activestate.com/recipes/tags/life-of/2011-12-05T11:45:45-08:00ActiveState Code RecipesAn extensible Conway's Game of Life (Python) 2011-12-05T11:45:45-08:00Filippo Squillacehttp://code.activestate.com/recipes/users/4174931/http://code.activestate.com/recipes/577976-an-extensible-conways-game-of-life/ <p style="color: grey"> Python recipe 577976 by <a href="/recipes/users/4174931/">Filippo Squillace</a> (<a href="/recipes/tags/animation/">animation</a>, <a href="/recipes/tags/game/">game</a>, <a href="/recipes/tags/life/">life</a>). </p> <p>This program is an extensible Conway's game of life. It allows to define different type of grid (for example 2D or 3D) and more complex rules. Each grid inherits an Abstract grid that implement the method (next()) to pass for the next configuration. Furthermore, each element can be whatever type. In this example I designed Grid2DBool that represent the simple Conway's game of life, but could be possible to develop and easily implement more complex grids and rules.</p> <p>Note: The demo save also the animation in a file .mp4 and plot it through pyplot. The demo could take long time because of storing all the configurations before showing the animation. Therefore, the visualization can be improved using other libraries (as wxpython) that paint the configuration of the grid once it's created. With a more complex view it's convenient to apply MVC pattern declaring the model AbstractGrid as the Observable class.</p>