game
Class State

java.lang.Object
  extended by game.State

public class State
extends java.lang.Object

Contains all information about the current state of the game with all necessary information available for the player.

Author:
Witthold/Korol

Field Summary
private  int button
           
private  boolean buttonClockwise
           
private  int currentHand
           
private  int currentPlayer
           
private  int currentRound
           
private  Gamedef gamedef
           
private  Player[] players
           
private  Round[] rounds
           
 
Constructor Summary
State(Gamedef gamedef)
           
 
Method Summary
 Action addAction(int round, char actionChar)
           
 Action addAction(int round, char actionChar, int totalInPot)
           
private  Action generateAction(int currentRound, char actionChar, int player)
           
 Player[] getActivePlayers()
          Returns all remaining active players.
 int getAnte()
           
 int[] getBetStructure()
           
 int getBigBlind()
           
 int[] getBlindPoster()
           
 int[] getBlindStructure()
           
 Card[] getBoardCards()
           
 int getButton()
           
 int getBuyin()
           
 int[] getCashDeltas()
           
 int getCurrentRound()
           
 Card[] getDeadCards()
           
 int getGamedefsMinPlayers()
           
 int getHighestBet()
           
 java.lang.String getHistory(int round)
          Returns the bet history of the given round as a string.
 int getLimit()
           
 int getMaxBet()
           
 int getMinBet()
           
 int getNextActivePlayer()
           
 int getNextActivePlayer(int position)
           
 int getPlayerByName(java.lang.String string)
           
 Player[] getPlayers()
          Returns the players as an array.
 int[] getPositions()
           
 int getPotSize()
           
private  int getPreviousActivePlayer(int position)
           
 int[] getRankings()
           
 Round getRound()
           
 Round getRound(int n)
           
 int getSmallBlind()
           
 int getStyle()
          Returns an integer representing the game style.
private  void initBoardCards()
          Prepares the storage of the board cards.
 boolean isCheckable()
          Returns if the bot has the option to check.
private  boolean isDoylesGame()
          Checks if the game is a "Doyle's game".
 boolean isMyMove()
          Checks if it is the bot's turn.
private  boolean isTournament()
           
 void newHand()
           
 void newRound()
           
 void printState()
           
 void reorderPlayers(int ownIndex)
          Changes the players array to an order in which the own index is 0, the player next to one self 1 and so on.
 void reset()
          Resets the player states and board cards for the beginning of a new hand.
private  void setBlind(int player, int size)
           
 void setBoardCards(int round, Card[] cards)
          Stores the revealed board cards of the given round.
 void setCurrentPlayer(int player)
          Sets the current player to the given index.
 int[][] setGetBlinds()
           
 void setHand(int ownPosition, int hand)
          Sets the hand counter to the given and updates the position of the players.
 void setHoleCards(Card[][] holeCards)
           
 void setHoleCards(int player, Card[] cards)
           
 void setNextActivePlayer()
           
 void setPlayers(java.lang.String[] names, int[] buyins)
          Stores names & buyins of the players.
 void showdown(int[] winsPerPlayer)
           
 void updatePlayerPositions()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

gamedef

private Gamedef gamedef

currentHand

private int currentHand

players

private Player[] players

button

private int button

currentPlayer

private int currentPlayer

rounds

private Round[] rounds

buttonClockwise

private boolean buttonClockwise

currentRound

private int currentRound
Constructor Detail

State

public State(Gamedef gamedef)
Method Detail

initBoardCards

private void initBoardCards()
Prepares the storage of the board cards.


setPlayers

public void setPlayers(java.lang.String[] names,
                       int[] buyins)
Stores names & buyins of the players.

Parameters:
names - all names of the players
buyins - buy ins of the players

updatePlayerPositions

public void updatePlayerPositions()

generateAction

private Action generateAction(int currentRound,
                              char actionChar,
                              int player)

getHighestBet

public int getHighestBet()

getPotSize

public int getPotSize()

setGetBlinds

public int[][] setGetBlinds()

setBlind

private void setBlind(int player,
                      int size)

setNextActivePlayer

public void setNextActivePlayer()

getNextActivePlayer

public int getNextActivePlayer()

getNextActivePlayer

public int getNextActivePlayer(int position)

getPreviousActivePlayer

private int getPreviousActivePlayer(int position)

setHoleCards

public void setHoleCards(int player,
                         Card[] cards)

setHoleCards

public void setHoleCards(Card[][] holeCards)

setBoardCards

public void setBoardCards(int round,
                          Card[] cards)
Stores the revealed board cards of the given round.

Parameters:
round - Round in which given cards are revealed
cards - Revealed cards

getPlayers

public Player[] getPlayers()
Returns the players as an array.

Returns:
Player array

getActivePlayers

public Player[] getActivePlayers()
Returns all remaining active players.

Returns:
Array of active players

getHistory

public java.lang.String getHistory(int round)
Returns the bet history of the given round as a string.

Parameters:
round - Round of the bet history
Returns:
The bet history of a round as a string

isCheckable

public boolean isCheckable()
Returns if the bot has the option to check.

Returns:
true if the bot has the option to check

isMyMove

public boolean isMyMove()
Checks if it is the bot's turn.

Returns:
true if the bot is the current player

setCurrentPlayer

public void setCurrentPlayer(int player)
Sets the current player to the given index.

Parameters:
player - Index of the who should be the current player

setHand

public void setHand(int ownPosition,
                    int hand)
Sets the hand counter to the given and updates the position of the players.
If it is the first hand, it also arranges the players so that the own index is 0.

Parameters:
ownPosition - The own position in this hand
hand - The number hand of the current hand.

reorderPlayers

public void reorderPlayers(int ownIndex)
Changes the players array to an order in which the own index is 0, the player next to one self 1 and so on.

Parameters:
ownIndex - Index of the own player before the ordering

reset

public void reset()
Resets the player states and board cards for the beginning of a new hand.


printState

public void printState()

showdown

public void showdown(int[] winsPerPlayer)

isDoylesGame

private boolean isDoylesGame()
Checks if the game is a "Doyle's game".
It is only possible for no limit games!


getStyle

public int getStyle()
Returns an integer representing the game style.

Returns:
1: cash game
2: tournament
3: doyle's game

isTournament

private boolean isTournament()

getLimit

public int getLimit()

getPositions

public int[] getPositions()

addAction

public Action addAction(int round,
                        char actionChar)

addAction

public Action addAction(int round,
                        char actionChar,
                        int totalInPot)

newRound

public void newRound()

newHand

public void newHand()

getMinBet

public int getMinBet()

getMaxBet

public int getMaxBet()

getBuyin

public int getBuyin()

getSmallBlind

public int getSmallBlind()

getBigBlind

public int getBigBlind()

getAnte

public int getAnte()

getRound

public Round getRound()

getRound

public Round getRound(int n)

getCurrentRound

public int getCurrentRound()

getCashDeltas

public int[] getCashDeltas()

getRankings

public int[] getRankings()

getBetStructure

public int[] getBetStructure()

getBlindStructure

public int[] getBlindStructure()

getButton

public int getButton()

getBlindPoster

public int[] getBlindPoster()

getGamedefsMinPlayers

public int getGamedefsMinPlayers()

getBoardCards

public Card[] getBoardCards()

getDeadCards

public Card[] getDeadCards()

getPlayerByName

public int getPlayerByName(java.lang.String string)