Blackjack

com.amoebacode.blackjack.core
Interface IPlayerHand

All Superinterfaces:
ICardCollection, IGameObject, IHand
All Known Implementing Classes:
PlayerHand

public interface IPlayerHand
extends IHand

IPlayerHand defines the public API used to manage one player's hand.

Version:
0.9
Author:
Jason Gurney

Method Summary
 void buyInsurance()
          Accepts the insurance offer.
 boolean canAct()
          Indicates whether the player can act on this hand.
 boolean canDoubleDown()
          Indicates whether the player can double down this hand.
 boolean canHit()
          Indicates whether the player can hit this hand.
 boolean canSplit()
          Indicates whether the player can split this hand.
 boolean canStand()
          Indicates whether the player can stand on this hand.
 boolean canSurrender()
          Indicates whether the player can accept surrender on this hand.
 void checkAction(java.lang.String action)
          Checks whether the specified user action is the proper basic strategy play.
 void computeNetGain(int dealerScore)
          Calculates the net gain for this hand based on the specified dealer score, the current bet, and the outcome.
 void declineInsurance()
          Declines the insurance offer.
 void doubleBet()
          Doubles the current bet and notifies the GUI listeners.
 int getBet()
          Returns the amount of the current bet for this hand.
 int getHandIndex()
          Returns the relative index of this hand within the player's collection of hands.
 double getNetGain()
          Returns the user's net gain for this hand.
 boolean hasSurrendered()
          Indicates whether the player has surrendered this hand.
 boolean offerInsurance()
          Indicates whether the player should be offered insurance.
 void split()
          Splits this hand's pair into two different hands.
 void stand()
          Stands on this hand.
 void surrender()
          Accepts surrender on this hand.
 void updateAvailableCommands()
          Updates the set of available player hand commands for each GUI listener.
 
Methods inherited from interface com.amoebacode.blackjack.core.IHand
clear, getBestTotal, getBestTotal, getCurrentScore, getHardTotal, getSoftTotal, hasBlackjack, hasBusted, hasPair, hasSoftTotal, hit
 
Methods inherited from interface com.amoebacode.blackjack.core.ICardCollection
addCard, getCardAt, getNextCard, getNumberOfCards, setCards
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Method Detail

canAct

public boolean canAct()
Indicates whether the player can act on this hand.
Returns:
true if the player can act

hasSurrendered

public boolean hasSurrendered()
Indicates whether the player has surrendered this hand.
Returns:
true if this hand has been surrendered

getHandIndex

public int getHandIndex()
Returns the relative index of this hand within the player's collection of hands.
Returns:
the hand index

computeNetGain

public void computeNetGain(int dealerScore)
Calculates the net gain for this hand based on the specified dealer score, the current bet, and the outcome. Also notifies the GUI listeners.
Parameters:
dealerScore - the score of the dealer hand

getBet

public int getBet()
Returns the amount of the current bet for this hand.
Returns:
the current bet

doubleBet

public void doubleBet()
Doubles the current bet and notifies the GUI listeners.

buyInsurance

public void buyInsurance()
Accepts the insurance offer.

declineInsurance

public void declineInsurance()
Declines the insurance offer.

split

public void split()
Splits this hand's pair into two different hands.

stand

public void stand()
Stands on this hand.

surrender

public void surrender()
Accepts surrender on this hand.

checkAction

public void checkAction(java.lang.String action)
Checks whether the specified user action is the proper basic strategy play.
Parameters:
action - a String representing the decision chosen

offerInsurance

public boolean offerInsurance()
Indicates whether the player should be offered insurance.
Returns:
true if the insurance should be offered

canHit

public boolean canHit()
Indicates whether the player can hit this hand.
Returns:
true if the player can hit

canStand

public boolean canStand()
Indicates whether the player can stand on this hand.
Returns:
true if the player can stand

canDoubleDown

public boolean canDoubleDown()
Indicates whether the player can double down this hand.
Returns:
true if the player can double down

canSplit

public boolean canSplit()
Indicates whether the player can split this hand.
Returns:
true if the player can split

canSurrender

public boolean canSurrender()
Indicates whether the player can accept surrender on this hand.
Returns:
true if the player can surrender

updateAvailableCommands

public void updateAvailableCommands()
Updates the set of available player hand commands for each GUI listener.

getNetGain

public double getNetGain()
Returns the user's net gain for this hand.
Returns:
the net gain

Blackjack

Copyright © 2002 amoebacode.com.