-footer

garrettsmith.blackjack
Interface EventHandler

All Known Implementing Classes:
TextPlayer

public interface EventHandler

Provides a callback interface for playing blackjack. The user implements this interface with logic that controls how the game should be played, then invokes Blackjack.playGame(EventHandler, double) to play a game.

See TextPlayer for an example implementation.

Since:
Blackjack v1.0
Version:
Blackjack v1.0, RCS $Revision: 1.1 $
Author:
Garrett Smith, gsmith at northwestern dot edu

Method Summary
 void fatalErrorOccurred(java.lang.Exception e)
          This method is invoked when an error occurs that prevents the game from completing.
 void handFinished(Hand hand, double gain, Result result, CardList dealerCards)
          Method that is invoked when a hand is done being played.
 boolean offerEarlySurrender(Hand hand)
          Method that is optionally invoked if the player has the option of early surrender.
 Move offerRegularTurn(Hand hand)
          Method invoked when the player is offered a turn.
 

Method Detail

fatalErrorOccurred

void fatalErrorOccurred(java.lang.Exception e)
This method is invoked when an error occurs that prevents the game from completing.

Parameters:
e - the exception that caused the error

handFinished

void handFinished(Hand hand,
                  double gain,
                  Result result,
                  CardList dealerCards)
Method that is invoked when a hand is done being played. Note that if a hand is split there may be multiple hands for each game played.

Parameters:
hand - the hand which has completed the game
gain - the winnings from the hand; negative if the wager was lost
result - the result of the hand; see Result
dealerCards - the cards that the dealer ended the hand with

offerEarlySurrender

boolean offerEarlySurrender(Hand hand)
Method that is optionally invoked if the player has the option of early surrender.

Parameters:
hand - the hand for which early surrender is being offered
Returns:
true if the user wishes to surrender; false otherwise

offerRegularTurn

Move offerRegularTurn(Hand hand)
Method invoked when the player is offered a turn. The implementor returns the appropriate Move they wish to make.

Parameters:
hand - the hand for which a turn is being offered
Returns:
the Move the player whishes to make

-footer

Copyright 2001-5 Garrett Smith. Use is subject to license terms.