Ruby-Poker 0.2.1

Ruby-Poker 0.2.1 is an incremental update over the 0.2.0 release. The biggest change is the addition of the << and delete methods to the PokerHand object. Making it possible to add and remove cards from a hand without creating a new PokerHand object.

require 'rubygems'
require 'ruby-poker'
 
hand.PokerHand.new("3d 3s 7h 7d")
hand.to_s                   # => "3d 3s 7h 7d (Two pair)"
 
hand << "7c"
hand.to_s                   # => "3d 3s 7h 7d 7c (Full house)"
 
hand.delete("3d")
hand.delete("3s")
hand.to_s                   # => 7h 7d 7c (Three of a kind)"

I’m always in the process of adding documentation to ruby-poker. At this point the majority of the public facing methods of the PokerHand and Card classes have been documented with examples. The ruby-docs are available online at http://rubypoker.rubyforge.org/.

Related posts

Comments

4 Responses to “Ruby-Poker 0.2.1”

  1. Ned on April 3rd, 2008 4:33 am

    Very nice library… I love the implementation.

  2. Ned on April 3rd, 2008 4:50 am

    BTW, bug…

    “Ac Qc Ks Kd 9d 3c” vs. “Ah Qs 9h Kh Kc 3s”

    <=> should give ‘0′… gives 1

  3. Rob Olson on April 3rd, 2008 8:12 am

    Thanks Ned. I’ll check into that bug and release a fix this weekend.

  4. Rob Olson on April 6th, 2008 10:08 am

    Alright, I fixed the bug and pushed out a release. Ruby-Poker-0.2.2 is now available here http://rubyforge.org/frs/?group_id=5257

    Thanks again Ned for the heads up on that.

Leave a Reply