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/.
Very nice library… I love the implementation.
BTW, bug…
“Ac Qc Ks Kd 9d 3c” vs. “Ah Qs 9h Kh Kc 3s”
<=> should give ’0′… gives 1
Thanks Ned. I’ll check into that bug and release a fix this weekend.
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.