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 9

Acey Deucey

As you become more comfortable with thinking like an object-oriented programmer, it becomes second nature to break projects down into objects that represent real-world concepts. You can imagine what the objects look like and how they behave. When you combine your ability to program objects with a rich library of built-in features like Ruby’s, you’ll find that you can create some pretty sophisticated projects without as much work as you might have to do in another programming language.

In this project, you’re going to combine a set of custom objects together with heavy use of Ruby’s array class to build a multiplayer card game called Acey Deucey, which requires you to create a number of objects, such as playing cards, a deck, players, and the game rules.

image

Organizing a New Project

This projects requires that you use Atom to create and edit your program. This time, you’ll store the project’s source code in multiple Ruby files, one for each object’s class. You’ll continue to use the Terminal program to run, test, and play the game.

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

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

    $ cd development

  2. Create a new directory for this project: ...

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