|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gbayer.basicblackjack.ui.ConsoleUI
public class ConsoleUI
An implementation of the UI interface for interacting with the user via stdin and stdout.
Field Summary | |
---|---|
static int |
HIT_ACTION_KEY
Constant - Key to select hit action. |
static int |
INITIAL_ACTION_FLAG
Constant - Flag to indicate initial action request. |
static int |
MAX_ACTION_KEY
Constant - Key to select last action. |
static int |
MIN_ACTION_KEY
Constant - Key to select first action. |
static int |
QUIT_INDICATOR_BET
Constant - The amount a user should bet to indicate a desire to stop playing. |
static int |
STAY_ACTION_KEY
Constant - Key to select stay action. |
Constructor Summary | |
---|---|
ConsoleUI()
Instantiates a new console UI reading from stdin and writing to stdout. |
|
ConsoleUI(java.io.InputStream in,
java.io.PrintStream out)
Instantiates a new console UI. |
Method Summary | |
---|---|
void |
dealerWinsRound()
Update UI to indicate that player wins the round |
void |
endRound()
Update UI to indicate that the hand has ended. |
void |
exitMsg()
Exit msg. |
Player.Action |
getUserActionChoice()
Get user to choose an action. |
java.lang.String |
getUserInput()
Gets the user's input. |
void |
introMsg()
Intro msg. |
void |
playerActionTaken(Player player,
Player.Action action)
Update UI to indicate the action that was taken. |
void |
playerStatus(Player currentPlayer)
Update status of players hand. |
void |
playerStatusWithCoveredCards(Player currentPlayer)
Update status of players hand. |
void |
playerWinsRound()
Update UI to indicate that player wins the round. |
void |
quitMessage()
Quit message. |
void |
roundIsPush()
Update UI to indicate that the round is a push. |
void |
takeBet(HumanPlayer currentPlayer)
Get user to place a bet. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int QUIT_INDICATOR_BET
public static final int HIT_ACTION_KEY
public static final int STAY_ACTION_KEY
public static final int MIN_ACTION_KEY
public static final int MAX_ACTION_KEY
public static final int INITIAL_ACTION_FLAG
Constructor Detail |
---|
public ConsoleUI()
public ConsoleUI(java.io.InputStream in, java.io.PrintStream out)
out
- the outMethod Detail |
---|
public void takeBet(HumanPlayer currentPlayer) throws GameQuitException
UI
takeBet
in interface UI
currentPlayer
- the current player
GameQuitException
- the game quit exceptionpublic Player.Action getUserActionChoice()
UI
getUserActionChoice
in interface UI
public java.lang.String getUserInput()
UI
getUserInput
in interface UI
public void playerStatus(Player currentPlayer)
UI
playerStatus
in interface UI
currentPlayer
- the current playerpublic void playerStatusWithCoveredCards(Player currentPlayer)
UI
playerStatusWithCoveredCards
in interface UI
currentPlayer
- the current playerpublic void playerWinsRound()
UI
playerWinsRound
in interface UI
public void dealerWinsRound()
UI
dealerWinsRound
in interface UI
public void roundIsPush()
UI
roundIsPush
in interface UI
public void playerActionTaken(Player player, Player.Action action)
UI
playerActionTaken
in interface UI
player
- the playeraction
- the actionpublic void endRound()
UI
endRound
in interface UI
public void quitMessage()
UI
quitMessage
in interface UI
public void introMsg()
UI
introMsg
in interface UI
public void exitMsg()
UI
exitMsg
in interface UI
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |