Project 12

Game of Life

Have you ever wondered how a flock of birds can fly together without running into one another? What about bees building a hive or ants building a nest? When you have many animals, plants, or even software objects following simple rules all at the same time, it can lead to surprising behavior that appears quite complex.

For the last project in this book, you’ll be writing the software that implements British mathematician John Conway’s Game of Life. You’ll use Gosu to visually explore how following a very simple set of rules can lead to cool visual effects.

image

Organizing a New Project

For your last project, you’ll create multiple Ruby source files using Atom. Again, all files will be named after either the project or the class that they contain, using the lowercase version of the class name when available. All the files will be stored in the same project directory. The Game of Life project uses Gosu to visualize the simulated single-cell creatures you create and also uses the command line to launch the program and gather options from the user.

remember If you haven’t created a development folder already, refer to Project 2 for details on how to do that.

  1. Start your terminal program and enter the development folder:

    $ cd development

  2. Create a new directory for this ...

Get Ruby For Kids For Dummies 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.