poker
Class Dealer

java.lang.Object
  |
  +--poker.Dealer
All Implemented Interfaces:
java.lang.Runnable

public class Dealer
extends java.lang.Object
implements java.lang.Runnable

This is a standard dealer class for managing a Holdem game. Does not (yet) handle 'all-In' situations


Field Summary
protected  java.util.Hashtable bettors
           
protected  Deck gDeck
           
protected  GameInfo gInfo
           
protected  Hand[] holes
           
protected  Reporter r
           
 
Constructor Summary
Dealer()
          Constructor.
Dealer(int seed)
          Constructor w/ random seed.
 
Method Summary
 boolean addPlayer(java.lang.String name, Player b)
          Add a player to the next game (if there is room)
protected  boolean betLoop()
           
 void dealCards()
           
 GameInfo getGameInfo()
          Obtain the game info for the current game.
 int getToAct()
           
 boolean inGame(java.lang.String name)
          Check if a player with a given name is already in the game.
 boolean insertPlayer(java.lang.String name, Player b, int pos)
          Add a player to the next game (if there is room)
 Card nextBoardCard()
           
static java.lang.String pad(java.lang.String s, int size)
           
 void playGame()
          Play one game of poker with the current set of players
protected  void print(java.lang.String s)
           
protected  void println(java.lang.String s)
           
 void printTable()
           
 void removeAllPlayers()
          Remove all players from the next game.
 boolean removePlayer(java.lang.String name)
          Remove a player from the next game.
 void run()
           
 void setSeed(int seed)
           
 void setThreaded(boolean th)
           
protected  void showdown()
           
protected  void updatePlayers(int action, int code)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

r

protected Reporter r

gInfo

protected GameInfo gInfo

gDeck

protected Deck gDeck

bettors

protected java.util.Hashtable bettors

holes

protected Hand[] holes
Constructor Detail

Dealer

public Dealer()
Constructor.

Dealer

public Dealer(int seed)
Constructor w/ random seed.
Parameters:
seed - the random seed to use for deck shuffling
Method Detail

setThreaded

public void setThreaded(boolean th)

setSeed

public void setSeed(int seed)

addPlayer

public boolean addPlayer(java.lang.String name,
                         Player b)
Add a player to the next game (if there is room)
Parameters:
name - the name of the player to add
b - the actual player which will make decisions
Returns:
true if player is added, flase if not

insertPlayer

public boolean insertPlayer(java.lang.String name,
                            Player b,
                            int pos)
Add a player to the next game (if there is room)
Parameters:
name - the name of the player to add
b - the actual player which will make decisions
Returns:
true if player is added, flase if not

removePlayer

public boolean removePlayer(java.lang.String name)
Remove a player from the next game.
Parameters:
name - the name of the player
Returns:
true if removed, false if not

removeAllPlayers

public void removeAllPlayers()
Remove all players from the next game.

getGameInfo

public GameInfo getGameInfo()
Obtain the game info for the current game.

inGame

public boolean inGame(java.lang.String name)
Check if a player with a given name is already in the game.
Parameters:
name - the player name to check
Returns:
true if the player is in the game

printTable

public void printTable()

dealCards

public void dealCards()

nextBoardCard

public Card nextBoardCard()

playGame

public void playGame()
Play one game of poker with the current set of players

getToAct

public int getToAct()

betLoop

protected boolean betLoop()

showdown

protected void showdown()

run

public void run()
Specified by:
run in interface java.lang.Runnable

updatePlayers

protected void updatePlayers(int action,
                             int code)

println

protected void println(java.lang.String s)

print

protected void print(java.lang.String s)

pad

public static java.lang.String pad(java.lang.String s,
                                   int size)