com.gbayer.basicblackjack
Class HumanPlayer

java.lang.Object
  extended by com.gbayer.basicblackjack.Player
      extended by com.gbayer.basicblackjack.HumanPlayer

public class HumanPlayer
extends Player

A human Player that takes action based on UI prompts.


Nested Class Summary
 
Nested classes/interfaces inherited from class com.gbayer.basicblackjack.Player
Player.Action
 
Field Summary
static int INVALID_BET_FLAG
          Constant - Flag indicating that no bet has been placed.
 
Constructor Summary
HumanPlayer(java.lang.String name, int startingChips)
          Instantiates a new human player.
 
Method Summary
 void betChips(int chips)
          Bet chips.
 int getChipCount()
          Gets the player's current chip count.
 void looseBet()
          Player looses bet.
 Player.Action takeAction(UI ui)
          Human player takes action based on UI prompts.
 void winBet()
          Player wins bet.
 
Methods inherited from class com.gbayer.basicblackjack.Player
dealCard, getHand, getName, newHand, toString, toStringShowingTopCardOnly
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

INVALID_BET_FLAG

public static final int INVALID_BET_FLAG
Constant - Flag indicating that no bet has been placed.

See Also:
Constant Field Values
Constructor Detail

HumanPlayer

public HumanPlayer(java.lang.String name,
                   int startingChips)
Instantiates a new human player.

Parameters:
name - the player's name
startingChips - number of starting chips
Method Detail

takeAction

public Player.Action takeAction(UI ui)
Human player takes action based on UI prompts.

Specified by:
takeAction in class Player
Parameters:
ui - the user interface
Returns:
action taken

getChipCount

public int getChipCount()
Gets the player's current chip count.

Returns:
the chip count

betChips

public void betChips(int chips)
Bet chips.

Parameters:
chips - the number of chips

winBet

public void winBet()
Player wins bet. Previously bet chips are add to the player's chip count. Note: Bet chips must be called first.


looseBet

public void looseBet()
Player looses bet. Previously bet chips are subtracted from the player's chip count. Note: Bet chips must be called first.