4
1
This is a very stripped down version of A BlackJack KOTH contest...
This is the goal:
Upon the execution: There are two inputs, "H" to hit (have the code deal a card), "S" to stand (Stop getting cards, and let dealer try to win).
Coding Rules:
- There is no betting or splitting of hands, for simplicity of the challenge.
- Suits are HDCS; standing for Hearts, Diamonds, Clubs and Spades respectively.
- Trumps must be formatted as A23456789TJQK, where T is the 10; therefore TH is the 10 of Hearts, etc.
- A is worth 1 or 11. Face cards are worth 10 points. A perfect game is 21 points.
- If you go over 21 points, the output along with the cards must show "BUST".
- If the dealer goes over 21 points and you're standing, output with cards must show "WIN"
- If the dealer beats you even though you're standing, output with cards must show "LOSE"
- If the dealer matches your score on standing, output with cards must show "PUSH"
- Dealer must stand on 17 through to 21.
- If you Stand, it calculates your score and displays it (see below), and then goes into dealer play mode. If the dealer stands or busts, it calculates its score and displays it.
- Standard 52 cards in a deck, no duplicates can be generated.
Output must resemble the following:
H Your hand: 3H H Your hand: 3H 8S H Your hand: 3H 8S 9D S Standing... Your hand: 3H 8S 9D = 20 points My hand: 2C 5H 8H 9S = 24 points WINShortest code wins
Well, I was going to do this in PowerShell but I'm getting hung up on the damn aces. Handling one is probably simple enough, but more than that seems tricky (and not really golf-friendly). – Iszi – 2013-12-12T02:04:27.033
The game play exemplified in your output is not really accurate for Blackjack. I don't mind that it requires an initial request to deal the hand, but the first deal should be two cards. Also, should the dealer still take their turn (normally doesn't) if the player hits 21 or Blackjack (A and T/J/K/Q on initial dealing)? Any special announcement required for 21 or Blackjack? – Iszi – 2013-12-12T02:08:19.910
@Iszi I know, but like I said, it's very simplified.. I'm not asking for the Bellagio, I'm just asking for a simple game - nothing more ;) – WallyWest – 2013-12-12T23:49:05.157