Blackjack Assignment

Blackjack is a card game. The point of the game is to try and get a score as close to 21 as possible. Initially, every player is given two cards. You must add the two cards together in the following way:

Cards Value
2 2
3 3
... ...
10 10
Jack 10
Queen 10
King 10
Ace 11 (usually)

So if you have a 5 and a king, you would add 5 + 10 = 15. After that, you can draw as many cards as you want. When you draw another card, is it called "hitting". If you are happy with 15, you can stay. However, if you want to chance it, you can hit and hope it that the card is a 6 or less.

However, the dealer plays the game a little differently. The dealer also initially gets two cards, but they are forced to keep drawing until they get a number between 17 and 21. For instance, if the dealer drew that 5 and king, then the dealer would be forced to draw another card. If that next card places him above 21, the dealer automatically loses, and is "busted". Here is where the ace acts differently. Let us say that the dealer has 15, and then draws an ace. Instead of acting like 11, the ace now is worth only 1. Now the dealer has 16, and has to draw one more card.

There is one more rule: if the first two cards dealt are an ace and a card worth 10 (10, jack, queen, or king), then the dealer gets "Blackjack" and automatically wins the game.

Here, I will show an automated program using JavaScript that will show what will happen to the dealer in a mock game of Blackjack. There will be no other players. (Keep reloading this page to different cards drawn)








back