Ruby-Poker: A Poker library for Ruby
In my never ending quest for 100% completion of Project Euler I came to Problem 54 which required determining the winner in 1000 hands of 5 card poker. At first I thought this would be no big deal. Determining whether one hand is greater than another in poker? There’s got to be a library for doing that right? Unfortunately, it looks like someone was about to do one on RubyForge called libpoker but the project was abandoned right after it was started.
So… there’s no Ruby library. Guess I’m doing it myself. The solution was longer than I excepted, just over 200 lines, which is my longest ProjectEuler solution thus far. After finishing I extracted the poker logic into its own RubyGem to make it easy for other people who wanted to make a simple poker game or whatever else they might need it for.
Creating the RubyForge project and the RubyGem for ruby-poker was more time consuming than I had anticipated having never done it before but overall a pretty smooth process and worked out in the end.
Ruby-Poker installation is a snap. If you have RubyGems installed it’s as simple as:
gem install ruby-poker
Update 01/21/08: I wrote a guide for using ruby-poker.
