|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectorg.jscience.computing.game.AbstractGame
org.jscience.computing.game.cards.BlackJack
public class BlackJack
BlackJack implements the rules for playing BlackJack. The casino rules of the game are embedded in this class with the implementations of listLegalMoves(), dealerMove() and getResult(int playerRole). Todo for a future version: strip out casino rules and make them available as options that can be changed through public methods.
| Field Summary | |
|---|---|
static int |
BURN_CARDS
DOCUMENT ME! |
static int |
MINIMUM_CARDS
DOCUMENT ME! |
static int |
NUMBER_OF_DECKS
DOCUMENT ME! |
| Constructor Summary | |
|---|---|
BlackJack()
Creates a new BlackJack object. |
|
BlackJack(CardDeck deck,
float[] bet)
Creates a new BlackJack object. |
|
BlackJack(CardDeck deck,
float[] bet,
java.util.Random random)
Creates a new BlackJack object. |
|
BlackJack(float bet)
Creates a new BlackJack object. |
|
BlackJack(float[] bet)
Creates a new BlackJack object. |
|
BlackJack(float[] bet,
java.util.Random random)
Creates a new BlackJack object. |
|
| Method Summary | |
|---|---|
java.lang.Object |
clone()
Note: the cloned object will have a separate Random object assiciated with it, so that operations on the cloned object will not affect the random numbers of the original. |
boolean |
gameOver()
DOCUMENT ME! |
static int |
getCardValue(Card card,
boolean softCount)
DOCUMENT ME! |
org.jscience.computing.game.cards.BJHand |
getCurrentHand(int playerRole)
getCurrentHand() is internally a wrapper which returns a clone of the actual BJHand used in the game |
java.util.Vector<Card> |
getDealerCards()
DOCUMENT ME! |
CardDeck |
getDeck()
DOCUMENT ME! |
static int |
getHandValue(java.util.Collection cards)
DOCUMENT ME! |
Card |
getOpenDealerCard()
DOCUMENT ME! |
double |
getResult(int playerRole)
DOCUMENT ME! |
int[] |
getWinner()
DOCUMENT ME! |
static boolean |
isBlackJack(java.util.Collection cards)
Note that a Vector of cards may not be considered BlackJack even though this function returns true, which is the case if the particular hand is derived from an Ace split. |
static boolean |
isSoft(java.util.Collection cards)
DOCUMENT ME! |
protected GameMove[] |
listLegalMoves()
DOCUMENT ME! |
int |
nextPlayer()
DOCUMENT ME! |
protected boolean |
popMove()
DOCUMENT ME! |
protected boolean |
pushMove(GameMove move)
DOCUMENT ME! |
java.lang.String |
toString()
DOCUMENT ME! |
| Methods inherited from class org.jscience.computing.game.AbstractGame |
|---|
clearRedoList, getGameName, getLastMove, getLastPlayer, getLegalMoves, getLegalMoves, getMoveHistory, getNumberOfRedoMoves, getRedoList, isLegalMove, isWinner, loadFromFile, makeMove, numberOfMoves, numberOfPlayers, redoMove, resetLegalMoves, resetLists, saveToFile, spawnChild, undoLastMove, undoMoves |
| Methods inherited from class java.lang.Object |
|---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
public static int NUMBER_OF_DECKS
public static int MINIMUM_CARDS
public static int BURN_CARDS
| Constructor Detail |
|---|
public BlackJack()
public BlackJack(float bet)
bet - DOCUMENT ME!public BlackJack(float[] bet)
bet - DOCUMENT ME!
public BlackJack(float[] bet,
java.util.Random random)
bet - DOCUMENT ME!random - DOCUMENT ME!
public BlackJack(CardDeck deck,
float[] bet)
deck - DOCUMENT ME!bet - DOCUMENT ME!
public BlackJack(CardDeck deck,
float[] bet,
java.util.Random random)
deck - DOCUMENT ME!bet - DOCUMENT ME!random - DOCUMENT ME!| Method Detail |
|---|
public Card getOpenDealerCard()
public java.util.Vector<Card> getDealerCards()
public CardDeck getDeck()
public org.jscience.computing.game.cards.BJHand getCurrentHand(int playerRole)
playerRole - DOCUMENT ME!
public static int getHandValue(java.util.Collection cards)
cards - DOCUMENT ME!
public static boolean isSoft(java.util.Collection cards)
cards - DOCUMENT ME!
public static int getCardValue(Card card,
boolean softCount)
card - DOCUMENT ME!softCount - DOCUMENT ME!
public static boolean isBlackJack(java.util.Collection cards)
cards - DOCUMENT ME!
public boolean gameOver()
gameOver in class AbstractGamepublic int[] getWinner()
public double getResult(int playerRole)
getResult in interface GamePlaygetResult in class AbstractGameplayerRole - DOCUMENT ME!
public int nextPlayer()
protected GameMove[] listLegalMoves()
listLegalMoves in class AbstractGameprotected boolean pushMove(GameMove move)
pushMove in class AbstractGamemove - DOCUMENT ME!
protected boolean popMove()
popMove in class AbstractGame
public java.lang.Object clone()
throws java.lang.CloneNotSupportedException
clone in interface GamePlayclone in class AbstractGamejava.lang.CloneNotSupportedException - DOCUMENT ME!AbstractGame.spawnChild(GameMove)public java.lang.String toString()
toString in class AbstractGame
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||