Blackjack

com.amoebacode.blackjack.core
Class Round

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.GameObject
        |
        +--com.amoebacode.blackjack.core.Round
All Implemented Interfaces:
IGameObject, IRound

class Round
extends GameObject
implements IRound

Round manages a round of blackjack, including the dealer hand and the player.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  IDealer dealer
          The dealer hand object
private  IPlayer player
          The set of player hands
 
Fields inherited from class com.amoebacode.blackjack.core.GameObject
listeners, parent
 
Constructor Summary
protected Round(IGame game)
          Default protected constructor.
 
Method Summary
 boolean allPlayerHandsBlackjack()
          Indicates whether all of the player hands have blackjack.
 boolean allPlayerHandsBustedOrSurrendered()
          Indicates whether all of the player hands have busted or surrendered.
 void checkAction(IPlayerHand playerHand, java.lang.String action)
          Checks whether the specified user action is the proper basic strategy play.
 void clear()
          Clears each of the round participants.
 void completeDealer()
          Completes the dealer (called when the player is finished).
 boolean dealerHasBlackjack()
          Indicates whether the dealer has blackjack.
 boolean firstDealerCardIsAce()
          Indicates whether insurance should be offered to the user.
 double getPlayerNetGain()
          Returns the net gain for the player hands.
private  RoundEventListenerCollection getRoundEventListenerCollection()
          Returns the event listener collection for this round.
 boolean playerFinished()
          Indicates whether the player has finished all player hands.
 void setupParticipants()
          Sets up the dealer and player participants and notifies the GUI listeners.
 void startRound(int initialBet)
          Starts the round with the specified initial bet.
 void updateAvailableCommands()
          Updates the set of available player hand commands for each GUI listener.
 
Methods inherited from class com.amoebacode.blackjack.core.GameObject
addEventListener, getEventListenerCollection, getGame, getParent, hasParent, setEventListenerCollection
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 
Methods inherited from interface com.amoebacode.blackjack.core.IGameObject
addEventListener, getGame, getParent
 

Field Detail

dealer

private IDealer dealer
The dealer hand object

player

private IPlayer player
The set of player hands
Constructor Detail

Round

protected Round(IGame game)
Default protected constructor.
Parameters:
game - main IGame object
Method Detail

setupParticipants

public void setupParticipants()
Description copied from interface: IRound
Sets up the dealer and player participants and notifies the GUI listeners.
Specified by:
setupParticipants in interface IRound
See Also:
IRound.setupParticipants()

startRound

public void startRound(int initialBet)
Description copied from interface: IRound
Starts the round with the specified initial bet.
Specified by:
startRound in interface IRound
See Also:
IRound.startRound(int)

dealerHasBlackjack

public boolean dealerHasBlackjack()
Description copied from interface: IRound
Indicates whether the dealer has blackjack.
Specified by:
dealerHasBlackjack in interface IRound
See Also:
IRound.dealerHasBlackjack()

allPlayerHandsBustedOrSurrendered

public boolean allPlayerHandsBustedOrSurrendered()
Description copied from interface: IRound
Indicates whether all of the player hands have busted or surrendered. (This means that the dealer does not need to take any cards.)
Specified by:
allPlayerHandsBustedOrSurrendered in interface IRound
See Also:
IRound.allPlayerHandsBustedOrSurrendered()

allPlayerHandsBlackjack

public boolean allPlayerHandsBlackjack()
Description copied from interface: IRound
Indicates whether all of the player hands have blackjack. (This means that the dealer does not need to take any cards.)
Specified by:
allPlayerHandsBlackjack in interface IRound
See Also:
IRound.allPlayerHandsBlackjack()

playerFinished

public boolean playerFinished()
Description copied from interface: IRound
Indicates whether the player has finished all player hands.
Specified by:
playerFinished in interface IRound
See Also:
IRound.playerFinished()

completeDealer

public void completeDealer()
Description copied from interface: IRound
Completes the dealer (called when the player is finished).
Specified by:
completeDealer in interface IRound
See Also:
IRound.completeDealer()

clear

public void clear()
Description copied from interface: IRound
Clears each of the round participants.
Specified by:
clear in interface IRound
See Also:
IRound.clear()

firstDealerCardIsAce

public boolean firstDealerCardIsAce()
Description copied from interface: IRound
Indicates whether insurance should be offered to the user.
Specified by:
firstDealerCardIsAce in interface IRound
See Also:
IRound.firstDealerCardIsAce()

checkAction

public void checkAction(IPlayerHand playerHand,
                        java.lang.String action)
Description copied from interface: IRound
Checks whether the specified user action is the proper basic strategy play.
Specified by:
checkAction in interface IRound
See Also:
IRound.checkAction(IPlayerHand, String)

updateAvailableCommands

public void updateAvailableCommands()
Description copied from interface: IRound
Updates the set of available player hand commands for each GUI listener.
Specified by:
updateAvailableCommands in interface IRound
See Also:
IRound.updateAvailableCommands()

getRoundEventListenerCollection

private RoundEventListenerCollection getRoundEventListenerCollection()
Returns the event listener collection for this round.
Returns:
this object's RoundEventListenerCollection

getPlayerNetGain

public double getPlayerNetGain()
Description copied from interface: IRound
Returns the net gain for the player hands.
Specified by:
getPlayerNetGain in interface IRound
See Also:
IRound.getPlayerNetGain()

Blackjack

Copyright © 2002 amoebacode.com.