A ruby library for comparing and ranking poker hands.
gem install rpoker
hand1 = Hand.new("Ac Qh Jd Jh Qs")
hand2 = Hand.new(["2s", "3s", "5s", "4s", "As"])
hand1 < hand2
# => true
hand1.rank
# => :two_pair
hand2.rank
# => :straight_flush
To run rspec specs:
rake
To run a more comprehensive test for the ranking of over a million hands, first download the dataset using:
wget -P ./spec/fixtures http://archive.ics.uci.edu/ml/machine-learning-databases/poker/poker-hand-testing.data
Then run:
rake integration