Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## bot
Class Bot

    java.lang.Object
      bot.Bot

All Implemented Interfaces:
  IF_Bot_Talk

Direct Known Subclasses:
  DroolsBot, HSBremen1, RandomBot

    public abstract class Bot

extends java.lang.Object
implements IF_Bot_Talk

The frame for the whole bot. Strategy is to be implemented in a child class.

Author:
  Witthold/Korol

Field Summary
`protected java.lang.Integer` | `buyin`
`protected java.util.List<IF_GetEquity>` | `equities`
`protected java.util.List<IF_GetEstimation>` | `estimations`
`protected java.util.List<IF_ExtModule_Feed>` | `extFeeds`
`protected java.util.List<IF_SetGameStorage>` | `gameStorage`
`protected java.lang.String` | `myname`
`protected java.util.List<IF_GetProposal>` | `proposals`
`(package private) java.security.SecureRandom` | `random`
`protected State` | `state`
`protected Talk` | `talk`

Constructor Summary
`Bot(java.lang.String config)` Reads in the bots configuration file and initializes the bot accordingly.

Method Summary
`void` | `addAction(int round, char actionChar)`
`void` | `addAction(int round, char actionChar, int finalInPot)`
`void` | `endHand()` Sets the end of the hand by updating the state.
`void` | `endLastRound(Card[][] cards)`
`void` | `gameOver()`
`abstract int[]` | `getBet()` Returns the actual bet, which is to be sent to the server.
`int` | `getBuyin()`
`java.lang.String` | `getName()`
`int` | `getNumPlayers()`
`protected int[]` | `getRandomBet()` Returns a random bet (10% folding; 70% calling; 30% default raise)
`void` | `handleStateChange()` If it is the bot's turn, this method calls the getBet() method, converts the move and sends it to the talk object.
`private void` | `initExtProposal()`
`private boolean` | `isCall20able(int[] cashs, int raiseDelta)`
`protected abstract boolean` | `isPlayable()` The specific bot can decide, if he want to / can play this kind of game.
`boolean` | `newGame(Gamedef gamedef)` Initializes a new game.
`void` | `newRound()`
`void` | `printState()` Writes the the current state to the console.
`private void` | `provideNewActionInformation(Action action)`
`private void` | `provideNewHandInformation(int button, int round)`
`private void` | `provideNewHoleCardsInformation(int player, Card[] cards)`
`private void` | `provideNewRoundInformation(int round, Card[] newCards)`
`private void` | `provideShowdownInformation(int[] winsPerPlayer)`
`void` | `run()` Calls the run method of the talk object if the talk object is initialized.
`void` | `setBlinds()` Sets the blinds accordingly to the game definition.
`void` | `setBoardCards(int round, Card[] cards)` Updates
`int` | `setGetGamedef()`
`void` | `setHand(int position, int hand)` Sets the hand counter to the given and updates the position of the players.
`void` | `setHoleCards(int player, Card[] cards)` Sets the hole cards of the given player.
`void` | `setNextActivePlayer()`
`void` | `setPlayers(java.lang.String[] names, int[] buyins)` Stores names & buyins of the players.
`void` | `showdown(int[] profitsPerPlayer)` Allocates the profits of the players by the players order (the own index is at int[0]).
`void` | `showdown(java.lang.String[] names, int[] gains)` Allocates the profits of the players by name.
`void` | `storeCompetitionEndData()`
`void` | `storeCompetitionStartData()`
`void` | `storeHandEndData()`
`void` | `storeHandStartData()`
`void` | `storeRoundEndData()`
`void` | `storeRoundEndData(int n)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### random

    java.security.SecureRandom random

### myname

    protected java.lang.String myname

### buyin

    protected java.lang.Integer buyin

### state

    protected State state

### talk

    protected Talk talk

### proposals

    protected java.util.List<IF_GetProposal> proposals

### equities

    protected java.util.List<IF_GetEquity> equities

### estimations

    protected java.util.List<IF_GetEstimation> estimations

### extFeeds

    protected java.util.List<IF_ExtModule_Feed> extFeeds

### gameStorage

    protected java.util.List<IF_SetGameStorage> gameStorage

Constructor Detail

### Bot

    public Bot(java.lang.String config)

  Reads in the bots configuration file and initializes the bot accordingly.

  Parameters:
    `config` - - bots configuration file

Method Detail

### isPlayable

    protected abstract boolean isPlayable()

  The specific bot can decide, if he want to / can play this kind of game.

### getBet

    public abstract int[] getBet()

  Returns the actual bet, which is to be sent to the server. The first integer represents the kind of the bet as defined in BetInt.java The second integer is only necessary when the amount is to be specified.

  Returns:
    The calculated bet
  See Also:
    `BetInt`

### run

    public void run()

  Calls the run method of the talk object if the talk object is initialized.

### getRandomBet

    protected int[] getRandomBet()

  Returns a random bet (10% folding; 70% calling; 30% default raise)

  Returns:
    int[0]: -1, 1 or 2

### handleStateChange

    public void handleStateChange()

  If it is the bot's turn, this method calls the getBet() method, converts the move and sends it to the talk object.

  Specified by:
    `handleStateChange` in interface `IF_Bot_Talk`

### newGame

    public boolean newGame(Gamedef gamedef)

  Initializes a new game. Generates a new state with the given gamedef, searches the database for matching gamedef-ID (only if estimation module is loaded) and calls isPlayable().

  Specified by:
    `newGame` in interface `IF_Bot_Talk`
  Parameters:
    `gamedef` - The definition of the game
  Returns:
    The result of isPlayable()
  See Also:
    `isPlayable()`

### printState

    public void printState()

  Writes the the current state to the console.

### showdown

    public void showdown(java.lang.String[] names,
                         int[] gains)

  Allocates the profits of the players by name. Needs the showdown(int[]) method.

  Specified by:
    `showdown` in interface `IF_Bot_Talk`
  Parameters:
    `names` - Names of the winners
    `gains` - Gains of the corresponding winners

### showdown

    public void showdown(int[] profitsPerPlayer)

  Allocates the profits of the players by the players order (the own index is at int[0]).

  Specified by:
    `showdown` in interface `IF_Bot_Talk`
  Parameters:
    `profitsPerPlayer` - Profits of the players

### 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

### setBlinds

    public void setBlinds()

  Sets the blinds accordingly to the game definition.

  Specified by:
    `setBlinds` in interface `IF_Bot_Talk`

### setHand

    public void setHand(int position,
                        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.

### setHoleCards

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

  Sets the hole cards of the given player.

  Parameters:
    `player` - Player who has the given hole cards
    `cards` - Given board cards

### endLastRound

    public void endLastRound(Card[][] cards)

  Specified by:
    `endLastRound` in interface `IF_Bot_Talk`

### endHand

    public void endHand()

  Sets the end of the hand by updating the state. Tries to store the complete hand data into database.

### setBoardCards

    public void setBoardCards(int round,
                              Card[] cards)

  Updates

  Specified by:
    `setBoardCards` in interface `IF_Bot_Talk`

### setNextActivePlayer

    public void setNextActivePlayer()

### addAction

    public void addAction(int round,
                          char actionChar)

  Specified by:
    `addAction` in interface `IF_Bot_Talk`

### addAction

    public void addAction(int round,
                          char actionChar,
                          int finalInPot)

  Specified by:
    `addAction` in interface `IF_Bot_Talk`

### newRound

    public void newRound()

  Specified by:
    `newRound` in interface `IF_Bot_Talk`

### getName

    public java.lang.String getName()

  Specified by:
    `getName` in interface `IF_Bot_Talk`

### getBuyin

    public int getBuyin()

  Specified by:
    `getBuyin` in interface `IF_Bot_Talk`

### setGetGamedef

    public int setGetGamedef()

  Returns:
    gamedef_id

### storeCompetitionStartData

    public void storeCompetitionStartData()

### storeHandStartData

    public void storeHandStartData()

### storeRoundEndData

    public void storeRoundEndData()

### storeRoundEndData

    public void storeRoundEndData(int n)

### storeHandEndData

    public void storeHandEndData()

### storeCompetitionEndData

    public void storeCompetitionEndData()

### gameOver

    public void gameOver()

  Specified by:
    `gameOver` in interface `IF_Bot_Talk`

### getNumPlayers

    public int getNumPlayers()

### isCall20able

    private boolean isCall20able(int[] cashs,
                                 int raiseDelta)

### initExtProposal

    private void initExtProposal()

### provideNewHandInformation

    private void provideNewHandInformation(int button,
                                           int round)

### provideNewHoleCardsInformation

    private void provideNewHoleCardsInformation(int player,
                                                Card[] cards)

### provideNewActionInformation

    private void provideNewActionInformation(Action action)

### provideNewRoundInformation

    private void provideNewRoundInformation(int round,
                                            Card[] newCards)

### provideShowdownInformation

    private void provideShowdownInformation(int[] winsPerPlayer)

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD