From: Dave Aronson Date: 2011-10-03T02:22:56+09:00 Subject: Re: Variables, Arrays and Hashes. Another thing you might consider, depending whether your use case needs something this fancy, is to have a separate Card class that has constant class arrays (probably of symbols or strings) for Ranks and Suits (and possibly a Number_Of_Jokers), and instance attributes rank and suit. That will make it much easier to detect straights, flushes, straight flushes, n of a kind, etc., and to order cards as needed. You can then have a Deck class, that iterates over Card.Ranks and Card.Suits (and possibly Number_Of_Jokers) to fill itself (such as by populating an array member), which you can then shuffle, deal from, etc. The Deck class could just use one standard Card class. However, if you wanted to build in more flexibility, you could make Card a base class, maybe even with blank arrays and no jokers. You can inherit from it to make different Card classes just by changing the Ranks and Suits arrays and the Number_Of_Jokers. That way you could easily define Poker_Card, Pinochle_Card, Uno_Card, Tarot_Card, etc., and thereby make Decks of them without changing Deck at all, preserving methods like is_empty?, number_of_cards, deal_one_card, shuffle, etc. This was fresh in my mind from some interview homework. :-) -Dave -- LOOKING FOR WORK, preferably Ruby on Rails, in NoVa/DC; see main web site. Main Web Site: davearonson.com Programming Blog: codosaur.us Excellence Blog: dare2xl.com