blackjackanalyst.strategy
Class BasicStrategyPlayer

java.lang.Object
  extended by blackjackanalyst.strategy.BasicStrategyPlayer
All Implemented Interfaces:
PlayerStrategy
Direct Known Subclasses:
TrueCountBetPlayer

public class BasicStrategyPlayer
extends java.lang.Object
implements PlayerStrategy

A player that uses basic strategy correctly, provided the following table options:

The strategies used are based on the chart found at http://wizardofodds.com/blackjack.

Author:
Michael Parker

Nested Class Summary
 
Nested classes/interfaces inherited from interface blackjackanalyst.PlayerStrategy
PlayerStrategy.PlayerStrategyAction
 
Constructor Summary
BasicStrategyPlayer()
           
 
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 curr_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.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BasicStrategyPlayer

public BasicStrategyPlayer()
Method Detail

getAction

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

Specified by:
getAction in interface PlayerStrategy
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

public void shoeShuffled()
Description copied from interface: PlayerStrategy
This informs the strategy that the shoe has been shuffled.

Specified by:
shoeShuffled in interface PlayerStrategy

cardDealt

public void cardDealt(Card dealt_card)
Description copied from interface: PlayerStrategy
This informs the strategy that the given card has been dealt to some player.

Specified by:
cardDealt in interface PlayerStrategy
Parameters:
dealt_card - the card that was dealt

joinedTable

public void joinedTable(Table t)
Description copied from interface: PlayerStrategy
This informs the strategy that the player has now joined a table.

Specified by:
joinedTable in interface PlayerStrategy
Parameters:
t - the table the player has joined

leftTable

public void leftTable(Table t)
Description copied from interface: PlayerStrategy
This informs the strategy that the player has now left the table it previously joined.

Specified by:
leftTable in interface PlayerStrategy
Parameters:
t - the table the player has left

getBet

public int getBet(int bankroll)
Description copied from interface: PlayerStrategy
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.

Specified by:
getBet in interface PlayerStrategy
Parameters:
bankroll - the current bankroll of the player
Returns:
the bet made by the player

getInsuranceBet

public int getInsuranceBet(PlayerHand curr_hand,
                           int bet_amount)
Description copied from interface: PlayerStrategy
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.

Specified by:
getInsuranceBet in interface PlayerStrategy
Parameters:
curr_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