Awhile back, I got bored and started coding a game of Solitaire that could be played in a Ruby IRB shell.

I wanted to finish the game but never got around to it. So I thought of an idea!
What if I screencast test-driving the creation of a card game? That would be an incentive for me to finish the game and people could watch me test-drive a Ruby library and, eventually, a multiplayer web-based card game.
So here is Part 1 of my new screencast series on creating card games in Ruby!
Part 2: Go Fish in Ruby
In this screencast, we:
- Create a Card class that has a Suit and a Rank
- Create a parser for Card names so we can say
Card.parse("The Jack of Spades") - Use
const_missingto allow us to reference cards as constants, eg.TheJackOfSpades - Create a Deck class which holds many cards
- Make it easy to get a standard 52-card deck via
Deck.standard - Make sure we can easily shuffle a Deck of cards
- Add logic so we can easily draw certain cards from a Deck
We leave off with good Card and Deck classes that can be used in our next screencast, when we’ll make our first game!
Note: For the first part of the screencast, I use suite instead of suit … my bad!
You can view the code created during this screencast at: http://github.com/remi/remicasts/tree/playing-cards-1