Exercise: Black Jack

Objectives:

To design and implement a web service hosted in the cloud (Azure) to support the game BlackJack

Background:

You have an Azure account see Create an account on Microsoft Azure

You have already implement a small test web service and hosted it in the Azure-cloud

The Black Jack Game play:

This card play is fairly simple. you have a Player (could be severeal player) and a Dealer. Player(s) and Dealer take one card at a time from a card deck.

The one who have the value closesed to 21 win - But you may not exeed 21. In this card game the suites have NO influence only the values. The values are the face value except for Knight, Queen and

King which all count 10 and the Ace can take the value 1 or 11. Two exsamples A) 7 of spades + knight of diamonds = 7 + 10 => 17. B) Ace of clubs + 5 spades = 1 + 5 => 6 OR 11 + 6 => 17.

The player starts with 2 cards. Then (S)he decide if another card should be added.

The player decides when to stop taking more cards. For the dealer the rules are more simple, the dealer takes card until he have at least the value 17.

For more detail see https://www.blackjackinfo.com/blackjack-rules/

Hints

When developing the web services it is good practice to try the different steps locally before publishing the web service in the cloud (as you have notice p ublising take several minutes each time).

Exercises:

Make the model classes

Make the model classes' i.e. a class 'Card' to present a single card and a 'Carddeck' to hold all the cards i.e. from ace to king in all 4 colors (clubs, diamonds, hearts, spades)

The Carddeck needed at least two methods

Consider which datastucture is the best for 'Carddeck'.
Consider how to ensure the states i.e. when a card have been picked from the carddeck it can not been picked again.
(Hint: storage or for a start declare carddeck static)

Make the web interface for BlackJack part one - player

To make the Black Jack we have two parts - first the Player pick cards

Suggestions of methods to the player

Hint start with only one player

Make the web interface for BlackJack part two - dealer

After the player(s) have picked cards - then it is the dealer turn.

The dealer have strict rules to play the hand (see background) so the web service only have one service

Make a consumer

Make a consumer that make use of the web service to show the black jack game
(this can be any program - Console, wpf, metro app ...).

Additional improvements

Extra games