com.javaflair.pokerprophesier.api.adapter
Class PokerProphesierAdapter

java.lang.Object
  extended by com.javaflair.pokerprophesier.api.adapter.PokerProphesierAdapter

public class PokerProphesierAdapter
extends Object

The adapter is the principle class which clients use to communicate with the simulator. Typically, a client instantiates an adapter, sets the simulator parameters as required, runs the simulator using the specified hole cards, community cards and game state (i.e. hole cards dealt, flop cards dealt etc.) and then gets references to the helpers which the simulator populates, in order to retrieve the simulator results.

There are two types of simulation: A Me vs Opponents simulation and a Player vs Player simulation.

A Me vs Opponents simulation is from the perspective of me as a player in a game against several opponents. Using a mixture of simulation and pure statistics, the simulator uses my hole cards and the shared community cards to calculate my outs, the probability of improving my hand by the river, the probable hand any single opponent currently holds against my hand and my overall probability of winning the game.

The Me vs Opponents simulation can be configured to include/exclude certain types of hands when generating and calculating the simulation statistics. These parameters must be set before the simulation is executed. See the following methods:

The Me vs Opponents simulation is executed by calling the method runMySimulations(HoleCards, CommunityCards, int, int). After the method completes, the following helpers are populated (depending on the game state):

A Player vs Player simulation calculates the probability of every player in a group of players winning or tying a game, given the specified hole cards of each player and the shared community cards.

The Player vs Player simulation is executed by calling the method runPlayerSimulations(HoleCards[], CommunityCards, int). After the method completes, the following helper is populated:

The number of iterations (individual Hold'em games) to perform when executing both simulations can be defined using the following method: setNumSimulations(int). The default is 100000.

For examples of how to use the adapter, see the examples which are included in the installation nd are also available online: MySimulatorExample.java and PlayerSimulatorExample.java.

Author:
Javaflair

Field Summary
static int FLOP_CARDS_DEALT
          Game state: flop cards dealt
static int HOLE_CARDS_DEALT
          Game state: hole cards dealt
static int RIVER_CARD_DEALT
          Game state: river card dealt
static int TURN_CARD_DEALT
          Game state: turn card dealt
 
Constructor Summary
PokerProphesierAdapter()
          Constructs an instance of the adapter.
 
Method Summary
 MyGameStatsHelper getMyGameStatsHelper()
          Returns the helper which contains the probabilities of my winning, tying or losing the game.
 MyHandHelper getMyHandHelper()
          Returns the helper which contains the analysis of my current hand.
 MyHandStatsHelper getMyHandStatsHelper()
          Returns the helper which contains the probabilities of my making a particular hand by the river card.
 MyOutsHelper getMyOutsHelper()
          Returns the helper which contains the details and probabilities of my current outs.
 int getNumSimulations()
          Returns the number of iterations (individual Hold'em games) to perform when executing a simulation.
 OppHandStatsHelper getOppHandStatsHelper()
          Returns the helper which contains the probabilities of an opponent currently holding a particular hand.
 PlayerGameStatsHelper getPlayerGameStatsHelper()
          Returns the helper which contains the probabilities of each player winning/tying the game.
 UpdateHelper getUpdateHelper()
          Returns the update helper, which can be used to determine whether this installation of Poker Prophesier is current.
 boolean isMyOutsHoleCardSensitive()
          Returns a boolean indicating whether the significant (non-kicker) cards in my hand must contain at least one hole card to be included in the generated simulator statistics.
 boolean isOppHoleCardsRealistic()
          Returns a boolean indicating whether the simulator should use realistic, or at least vaguely playable, opponents' hole cards when determining possible opponents' hands.
 boolean isOppProbMyHandSensitive()
          Returns a boolean indicating whether an opponents' hand should only be included in the generated simulator statistics if it is better than my current hand.
 void runMySimulations(HoleCards holeCards, CommunityCards communityCards, int numSimPlayers, int currentRound)
          Runs the Me vs Opponents simulation, using my hole cards, the community cards, the total number of simulator players and the current game state.
 void runPlayerSimulations(HoleCards[] holeCards, CommunityCards communityCards, int currentRound)
          Runs the Player vs Player simulation, using the array of players' hole cards, the community cards and the current game state.
 void setMyOutsHoleCardSensitive(boolean isMyOutsHoleCardSensitive)
          Sets the boolean indicating whether the significant (non-kicker) cards in my hand must contain at least one hole card to be included in the generated simulator statistics.
 void setNumSimulations(int numSimulations)
          Sets the number of iterations (individual Hold'em games) to perform when executing a simulation.
 void setOppHoleCardsRealistic(boolean isOppHoleCardsRealistic)
          Sets the boolean indicating whether the simulator should use realistic, or at least vaguely playable, opponents' hole cards when determining possible opponents' hands.
 void setOppProbMyHandSensitive(boolean isOppProbMyHandSensitive)
          Sets the boolean indicating whether an opponents' hand should only be included in the generated simulator statistics if it is better than my current hand.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HOLE_CARDS_DEALT

public static final int HOLE_CARDS_DEALT
Game state: hole cards dealt

See Also:
Constant Field Values

FLOP_CARDS_DEALT

public static final int FLOP_CARDS_DEALT
Game state: flop cards dealt

See Also:
Constant Field Values

TURN_CARD_DEALT

public static final int TURN_CARD_DEALT
Game state: turn card dealt

See Also:
Constant Field Values

RIVER_CARD_DEALT

public static final int RIVER_CARD_DEALT
Game state: river card dealt

See Also:
Constant Field Values
Constructor Detail

PokerProphesierAdapter

public PokerProphesierAdapter()
Constructs an instance of the adapter.

Method Detail

runMySimulations

public void runMySimulations(HoleCards holeCards,
                             CommunityCards communityCards,
                             int numSimPlayers,
                             int currentRound)
                      throws SimulatorException
Runs the Me vs Opponents simulation, using my hole cards, the community cards, the total number of simulator players and the current game state. Upon completion of the method, the following helpers are populated (depending on the game state):

Parameters:
holeCards - my hole cards
communityCards - the community cards
numSimPlayers - the total number of simulator players (including me)
currentRound - the current round of the game: HOLE_CARDS_DEALT, FLOP_CARDS_DEALT, TURN_CARD_DEALT or RIVER_CARD_DEALT.
Throws:
SimulatorException - any simulator exception
See Also:
HoleCards, CommunityCards

runPlayerSimulations

public void runPlayerSimulations(HoleCards[] holeCards,
                                 CommunityCards communityCards,
                                 int currentRound)
                          throws SimulatorException
Runs the Player vs Player simulation, using the array of players' hole cards, the community cards and the current game state. Upon completion of the method, the following helper is populated:

Parameters:
holeCards - the players' hole cards
communityCards - the community cards
currentRound - the current round of the game: HOLE_CARDS_DEALT, FLOP_CARDS_DEALT, TURN_CARD_DEALT or RIVER_CARD_DEALT.
Throws:
SimulatorException - any simulator exception
See Also:
HoleCards, CommunityCards

getUpdateHelper

public UpdateHelper getUpdateHelper()
                             throws SimulatorException
Returns the update helper, which can be used to determine whether this installation of Poker Prophesier is current. This helper is always available and is independent of the simulator itself.

Returns:
the update helper
Throws:
SimulatorException - any simulator exception

getMyHandHelper

public MyHandHelper getMyHandHelper()
Returns the helper which contains the analysis of my current hand.

Populated after the runMySimulations(HoleCards, CommunityCards, int, int) simulator method is executed in all game states.

Returns:
my hand helper, or null if not populated
See Also:
runMySimulations(HoleCards, CommunityCards, int, int)

getMyGameStatsHelper

public MyGameStatsHelper getMyGameStatsHelper()
Returns the helper which contains the probabilities of my winning, tying or losing the game.

Populated after the runMySimulations(HoleCards, CommunityCards, int, int) simulator method is executed in all game states.

Returns:
my game stats helper, or null if not populated
See Also:
runMySimulations(HoleCards, CommunityCards, int, int)

getMyHandStatsHelper

public MyHandStatsHelper getMyHandStatsHelper()
Returns the helper which contains the probabilities of my making a particular hand by the river card.

Populated after the runMySimulations(HoleCards, CommunityCards, int, int) simulator method is executed, during the following game states: HOLE_CARDS_DEALT, FLOP_CARDS_DEALT and TURN_CARD_DEALT.

Returns:
my hand stats helper, or null if not populated
See Also:
runMySimulations(HoleCards, CommunityCards, int, int)

getMyOutsHelper

public MyOutsHelper getMyOutsHelper()
Returns the helper which contains the details and probabilities of my current outs.

Populated after the runMySimulations(HoleCards, CommunityCards, int, int) simulator method is executed, during the following game states: FLOP_CARDS_DEALT and TURN_CARD_DEALT.

Returns:
my outs helper, or null if not populated
See Also:
runMySimulations(HoleCards, CommunityCards, int, int)

getOppHandStatsHelper

public OppHandStatsHelper getOppHandStatsHelper()
Returns the helper which contains the probabilities of an opponent currently holding a particular hand.

Populated after the runMySimulations(HoleCards, CommunityCards, int, int) simulator method is executed, during the following game states: FLOP_CARDS_DEALT, TURN_CARD_DEALT and RIVER_CARD_DEALT.

Returns:
the opponent hand stats helper, or null if not populated
See Also:
runMySimulations(HoleCards, CommunityCards, int, int)

getPlayerGameStatsHelper

public PlayerGameStatsHelper getPlayerGameStatsHelper()
Returns the helper which contains the probabilities of each player winning/tying the game.

Populated after the runPlayerSimulations(HoleCards[], CommunityCards, int) simulator method is executed in all game states.

Returns:
the player game stats helper, or null if not populated
See Also:
runPlayerSimulations(HoleCards[], CommunityCards, int)

isMyOutsHoleCardSensitive

public boolean isMyOutsHoleCardSensitive()
Returns a boolean indicating whether the significant (non-kicker) cards in my hand must contain at least one hole card to be included in the generated simulator statistics. This gives the flexibility to include or exclude from the generated simulator statistics hands which are based purely on shared community cards.

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Returns:
true if my hand is hole card sensitive; false if not

setMyOutsHoleCardSensitive

public void setMyOutsHoleCardSensitive(boolean isMyOutsHoleCardSensitive)
Sets the boolean indicating whether the significant (non-kicker) cards in my hand must contain at least one hole card to be included in the generated simulator statistics. This gives the flexibility to include or exclude from the generated simulator statistics hands which are based purely on shared community cards.

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Parameters:
isMyOutsHoleCardSensitive - the boolean flag

isOppProbMyHandSensitive

public boolean isOppProbMyHandSensitive()
Returns a boolean indicating whether an opponents' hand should only be included in the generated simulator statistics if it is better than my current hand. This gives the option of ignoring potential opponent hands which are weaker than my current hand.

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Returns:
true if applicable; false if not

setOppProbMyHandSensitive

public void setOppProbMyHandSensitive(boolean isOppProbMyHandSensitive)
Sets the boolean indicating whether an opponents' hand should only be included in the generated simulator statistics if it is better than my current hand. This gives the option of ignoring potential opponent hands which are weaker than my current hand.

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Parameters:
isOppProbMyHandSensitive - the boolean flag

isOppHoleCardsRealistic

public boolean isOppHoleCardsRealistic()
Returns a boolean indicating whether the simulator should use realistic, or at least vaguely playable, opponents' hole cards when determining possible opponents' hands. Realistic is determined to be a pair of hole cards that:

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Returns:
true of the hole cards must be realistic; false if not

setOppHoleCardsRealistic

public void setOppHoleCardsRealistic(boolean isOppHoleCardsRealistic)
Sets the boolean indicating whether the simulator should use realistic, or at least vaguely playable, opponents' hole cards when determining possible opponents' hands.

Default is true - only applicable as a parameter to the runMySimulations(HoleCards, CommunityCards, int, int) simulation.

Parameters:
isOppHoleCardsRealistic - the boolean flag
See Also:
isOppHoleCardsRealistic()

getNumSimulations

public int getNumSimulations()
Returns the number of iterations (individual Hold'em games) to perform when executing a simulation.

Default is 100000 - applicable to both simulations.

Returns:
the number of simulations

setNumSimulations

public void setNumSimulations(int numSimulations)
Sets the number of iterations (individual Hold'em games) to perform when executing a simulation.

Default is 100000 - applicable to both simulations.

Parameters:
numSimulations - the number of simulations


Copyright © 2006 Javaflair. All Rights Reserved.