au.edu.mq.itec802.cardGame.blackjack
Class BlackjackGame

java.lang.Object
  extended by au.edu.mq.itec802.cardGame.blackjack.BlackjackGame
All Implemented Interfaces:
Game

public class BlackjackGame
extends java.lang.Object
implements Game

The Class BlackjackGame.

Simple Blackjack game (developed as Assignment 1 for ITEC802@MQ)

A game of Blackjack is played against the “House” (Casino). There are several versions of this game and I am explaining one of the versions. The idea of the game is to have 21 as the total value, where numerical cards have usual values, Jack, Queen and King are valued at 10 and Ace can be treated as 1 OR 10 by the player and house. The player comes in with a fixed amount of money (configurable). The house deals two cards to the player and itself, one at a time, in that order. To play a game, the player has to pay an initial amount (configurable) to play the game. The player can then choose to ask for more cards, till
-a. (s)he is happy/ confident of his/her cards (happens usually at an accumulated value between 18 and 21)
-b. (s)he goes bust (total exceeds 21) Automatic loss
Once the player completes his/her turn of getting more cards, the house does the same (house has to ask for more cards until it reaches 17) and if both are still in the game after that, the one with higher value (<=21) wins. For more information about this game, please refer to http://en.wikipedia.org/wiki/Blackjack
TODO: finish support for multiple players finish evaluation when multiple players win (same score -- split)

Version:
$Id: BlackjackGame.java 20/03/2011 jumbo$
Author:
Tomas Krajca

Constructor Summary
BlackjackGame(int playersNum, int[] amounts, int[] bets)
          Instantiates a new blackjack game.
 
Method Summary
 void play()
          Simulates the entire game (core method)
 java.lang.String toString()
          Formats and returns results of the game.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BlackjackGame

public BlackjackGame(int playersNum,
                     int[] amounts,
                     int[] bets)
Instantiates a new blackjack game.

Parameters:
playersNum - the number of player
amounts - the amounts that the players begin with
bets - the bets that the players bet every round
Method Detail

play

public void play()
Simulates the entire game (core method)

Specified by:
play in interface Game

toString

public java.lang.String toString()
Formats and returns results of the game.

Specified by:
toString in interface Game
Overrides:
toString in class java.lang.Object
Returns:
results of the game as String