0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
A gem for playing texas-holdem poker
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
>= 0
~> 10.0
>= 0

Runtime

 Project Readme

RubyHoldem

RubyHoldem is a set of classes which track the game state of a texas holdem poker game.

Installation

gem install ruby_holdem

Usage

require 'ruby_holdem'

players = ["Jack", "Joe", "Jil"]
poker_round = RubyHoldem::Round.new(players, 2, 4)

poker_round.make_move('raise', 2) # Jack raises small blinds
poker_round.make_move('raise', 4) # Joe raises big blinds
poker_round.make_move('fold') # Jil folds
poker_round.make_move('call') # Jack calls
poker_round.make_move('check') # Joe calls
poker_round.next_stage

puts poker_round.community_cards.join(' ')
# => i.e. 3s Js Qd

puts poker_round.pot_amount
# => 8

poker_round.make_move('raise', 3) # Jack raises 3
poker_round.make_move('fold') # Joe folds

puts poker_round.winner
# => Jack

TODO

  • Break monolithic Round class into smaller classes, i.e. Round, RoundState and RoundPlayerMove
  • Use rspec 3 style (subjects, expects etc.)
  • Get rid of the stubbing of action_history instance var in round_spec.rb
  • Have Game keep track of an entire poker game consisting of multiple rounds

License

RubyHoldem uses the MIT license. Please check the LICENSE file for more details.