blackjackanalyst
Interface PlayerStrategy

All Known Implementing Classes:
BasicStrategyPlayer, DefaultPlayer, ModifiedBasicStrategyPlayer, TrueCountBetPlayer

public interface PlayerStrategy

An interface to be implemented by a user-defined player strategy. A player strategy defines what action a player takes given a hand of cards.

Author:
Michael Parker

Nested Class Summary
static class PlayerStrategy.PlayerStrategyAction
          The possible player actions, which are hit, stand, double down, and split.
 
Method Summary
 void cardDealt(Card dealt_card)
          This informs the strategy that the given card has been dealt to some player.
 PlayerStrategy.PlayerStrategyAction getAction(PlayerHand player_hand, Card dealer_card)
          Returns the proper action, given the current hand.
 int getBet(int bankroll)
          Notifies the player that a new betting round has started.
 int getInsuranceBet(PlayerHand player_hand, int bet_amount)
          Notifies the player that the dealer is showing an ace as his up card and is offering insurance.
 void joinedTable(Table t)
          This informs the strategy that the player has now joined a table.
 void leftTable(Table t)
          This informs the strategy that the player has now left the table it previously joined.
 void shoeShuffled()
          This informs the strategy that the shoe has been shuffled.
 

Method Detail

getAction

PlayerStrategy.PlayerStrategyAction getAction(PlayerHand player_hand,
                                              Card dealer_card)
Returns the proper action, given the current hand. If this method returns null, the caller determines what action is taken.

Parameters:
player_hand - the hand of cards belonging to the player
dealer_card - the card shown by the dealer
Returns:
the proper action, which is either hit, stand, double down, or split

shoeShuffled

void shoeShuffled()
This informs the strategy that the shoe has been shuffled.


cardDealt

void cardDealt(Card dealt_card)
This informs the strategy that the given card has been dealt to some player.

Parameters:
dealt_card - the card that was dealt

joinedTable

void joinedTable(Table t)
This informs the strategy that the player has now joined a table.

Parameters:
t - the table the player has joined

leftTable

void leftTable(Table t)
This informs the strategy that the player has now left the table it previously joined.

Parameters:
t - the table the player has left

getBet

int getBet(int bankroll)
Notifies the player that a new betting round has started. The bet made by the player is returned, which must be greater than or equal to 0 and less than or equal to bankroll.

Parameters:
bankroll - the current bankroll of the player
Returns:
the bet made by the player

getInsuranceBet

int getInsuranceBet(PlayerHand player_hand,
                    int bet_amount)
Notifies the player that the dealer is showing an ace as his up card and is offering insurance. This method returns the amount the player wants to insure, up to half his original bet. If this method returns 0, no insurance is taken.

Parameters:
player_hand - the hand of cards belonging to the player
bet_amount - the amount bet on the player hand
Returns:
the amount of money the player wants to insure