Class: CardNine::Dealers::TexasHoldem

Inherits:
CardNine::Dealer show all
Defined in:
lib/card_nine/dealers/texas_holdem.rb

Overview

implements a CardNine::Dealer for the game of Texas Holdem. This is only

the card movement, the betting, UI, and hand evaluation are out of the
scope of this library

card_eval = PretendCardEval.new ui = PretendUI.new wagering = PretendTexasHoldemBettingService.new players = %w|Bruce Barbera Dick| dealer = CardNine::Dealers::TexasHoldem.new(players: players) hand = dealer.new_hand ui.update(hand) wagering(:ante, hand) [:deal_hole_cards, :flop, :turn, :river].each do |stage|

ui.update(hand.deal_stage(stage))
wagering(:round, hand)

end wager(:resolve, hand)

Constant Summary collapse

STAGES =

A hash of stages

Returns:

  • (Hash<Symbol => Proc>)
{
    deal_hole_cards: ->(t) { t.deal_players(2) },
    flop:            ->(t) { t.discard; t.deal(3, to: :community) },
    turn:            ->(t) { t.discard; t.deal(to: :community) },
    river:           ->(t) { t.discard; t.deal(to: :community) },
    fold:            ->(t, p) { t.remove_player(p) }
}

Instance Attribute Summary

Attributes inherited from CardNine::Dealer

#deck, #locations, #players, #stages

Instance Method Summary collapse

Methods inherited from CardNine::Dealer

#deal

Constructor Details

#initializeTexasHoldem

create a new dealer using a PlayingCard Deck



37
38
39
# File 'lib/card_nine/dealers/texas_holdem.rb', line 37

def initialize
  super CardNine::Cards::PlayingCard.deck, [:community], STAGES
end