Simon Cozens > Games-Poker-TexasHold-em-1.4 > Games::Poker::TexasHold'em



Annotate this POD

View/Report Bugs
Module Version: 1.4   Source  


Games::Poker::TexasHold'em - Abstract state in a Hold'em game


  use Games::Poker::TexasHold'em;
  my $game = Games::Poker::TexasHold'em->new(
        players => [
            { name => "lathos", bankroll => 500 },
            { name => "MarcBeth", bankroll => 500 },
            { name => "Hectate", bankroll => 500 },
            { name => "RichardIII", bankroll => 500 },
        button => "Hectate",
        bet => 10,
        limit => 50
  $game->blinds; # Puts in both small and large blinds
  print $game->pot; # 15

  $game->call; # Hecate puts in 10
  $game->bet_raise(15) # RichardIII sees the 10, raises another 5


This represents a game of Texas Hold'em poker. It maintains the state of the pot, who's in to what amount, who's folded, what the bankrolls look like, and so on. It's meant to be used in conjunction with Games::Poker::OPP, but can be used stand-alone as well for analysis.



Starts a new game.

General information about the game


Returns the name of the player at the specified seat. Seats are numbered from zero.


Returns the names of all players in the game.


Returns the initial bet.


Returns the raise limit or 0 for unlimited.

Information about the current state of play


Returns the name of the player who's next to act in the game.


Returns the stage of play. (preflop, flop, turn, river, showdown)


Returns the bankroll of a given player.


Returns the investment in the pot of a given player.


Returns whether or not the given player has folded. Players may be specified by name or seat number.


Returns the current amount of cash in the pot


Returns whether or not the pot is square and the current stage should be ended.


Returns the current board, if you're using one; this is the set of things which have been passed in to "next_stage".


Similar to board, this is an opaque area where you can store your hole cards in whatever format you want to, if you want to.


Returns a nice table summarizing what's going on in the game.


These actions all apply to he current person who is next to act. No playing out of turn! After an action, play is advanced to the next player except in the case of blinds.


Puts in both small and large blinds. Play is not advanced, because blinds are taken from the left of the button. It's all so confusing.


Folds, taking the player out of the game.


Either checks, putting nothing in the pot, or calls, putting in however much the current player is short. Returns the amount put into the pot.

You can call the check or call methods if you feel happier with that, but they're identical.

bet_raise ($amount)

Bets, if there's currently no bet, or raises an amount up, up to the limit if there is one. The amount must include the call; that is, if you're short 10, you call


to see the 10 and raise another 10. (You'll get an error if it's less than you're short.) If you don't say how much to raise, it'll be raised by the intial bet.

As with check and call, you can call this either as bet or raise if you prefer.

"Control" actions

These are actions taken by the server or "dealer" rather than an individidual player.

next_stage (@cards)

Checks that the pot is square, and if so, advances to the next stage. Returns 1 if an advance was made, otherwise 0. The optional "cards" argument is treated as an opaque array which is added to the current board.


Simon Cozens, <>


Copyright 2003 by Simon Cozens

This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.

syntax highlighting: