O'Reilly logo

Ruby For Kids For Dummies by Christopher Haupt

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

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

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