What’s New in Ruby-Poker 0.2.0

Yesterday ruby-poker 0.2.0 was released. Here is a synopsis of what has changed.

Hands are no longer limited to 5 cards!

In order to play any poker game other than 5-card draw (like Texas Holdem) you need to evaluate hands containing more or less than 5 cards. Now you can with ruby-poker.

holdem_hand = PokerHand.new("Qc Qd Qs 5d 5h 8c 2h")   # Any number of cards you want

Specifying face cards using numbers is no longer supported

Previous to 0.2.0 face cards could be specified using their number value like so:

PokerHand.new("10c 11c 12c 13c 14c")  # old way

This no longer works and face cards must be created using their letters:

PokerHand.new("Tc Jc Qc Kc Ac")  # new way

to_s on PokerHand objects includes rank

hand1 = PokerHand.new("Tc Jc Qc Kc Ac")
puts hand1                #=> Tc Jc Qc Kc Ac (Royal Flush)

Straights with a low Ace work now

Previously straights like A-2-3-4-5 were not counted as being a straight by the old hand evaluator. This has been remedied in 0.2.0.

Update now!

If you have a previous version of the ruby-poker gem installed update with sudo gem update. Installing ruby-poker can still be done with sudo gem install ruby-poker.

4 thoughts on “What’s New in Ruby-Poker 0.2.0

  1. Geoffrey Lessel

    First of all, great class. I’m glad I did a search before setting out to make my own.

    One question I have though: is it possible to add or take cards away from the hand? For example, in Hold ‘Em, you start with two cards and have some added every betting round. Can the hands be ranked in each of those rounds easily without having to destroy and recreate the hands every time?

  2. Rob

    Geoffrey, it is currently not possible to add or remove cards from a hand. However, I had been considering adding those methods. I will give it a shot this weekend and let you know what I come up with.

    How necessary do you think a remove_card method would be though? I certainly see the use for add_card but are there games were remove_card is needed?

  3. Geoffrey Lessel

    Awesome, thank would be great!

    Yeah, I would think that a remove_card would be helpful for draw games where you can trade in cards in your hand for different cards from the dealer. Say you started with JS JD AC 2C 7H, you could trade in your 2C and 7H for two other cards. The player holding the hand would obviously make a mental ranking of his current had and trade in the cards he didn’t think were valuable for more.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>