You might want to have a constant for 21 possibly BlackJack , particularly since you have so many occurrences of it. Since you asked about the validity of the comment in shuffleArray …. I've added a critique of the comment in my answer. Time spent playing this game is definitely not a waste as it brings with it many stunning wins and prizes. Annoying pop-ups in demo.
Why play Codename: Jackpot Slot Machine Online?
Now every card player knows that winning at blackjack is all about mastering your basic strategy. The need to use smart strategies could be the first reason why this aircraft deserves to bear this reporting name. But this is not the only thing blackjack and the Tupolev Tu have in common. We discovered that they both have several variants. Over variations of blackjack have been documented in the long history of this card game, which is pretty impressive!
The Tupolev Tu is not doing so badly either. The aircraft has 9 different variants, including a proposed liquid hydrogen fueled version. In addition to these powerful fighting machines, the Tupolev Tu also has a strategic reconnaissance version and a commercial version. The best players, as well as the people who brought something to the table and contributed to improving this game are all listed in the Blackjack Hall of Fame. After some testing in late , the aircraft was accepted into Russian service and some upgrades were announced.
In , the first modernized Tu was delivered. Engineers have now split the modernization process into two separate phases. I'm a beginner and I've used what I know to date to complete this. You should make your entire application more Object Oriented. A good place to start would be to move the deck of cards and associated functions into other classes.
Here's an implementation of a deck stolen from a StackOverflow Question. Notice there's also a Card object. Also think about using enums for suit and a method of tracking the card value. Searching Google for Cark rank patterns will help with this.
Finally, your code is not very DRY. You need more of your functionality in separate methods to prevent you repeating yourself. A good example of this is that you have multiple win sequences. Also Blackjack is a repetitious game, turn two is identical to turn one, your code just repeats the same operations a second time.
Again this should be moved into methods. I'd just like to point out that though the cards would be better represented as objects instead of int s, and the program organization and flow is a bit muddled, your choice of shuffling algorithm is excellent.
The Fisher-Yates shuffle is a simple and unbiased way to randomize the order of the elements of an array, and you have a textbook implementation of it. Even if you didn't write the code yourself, I think you should get credit for picking the right code to copy.
Since you asked about the validity of the comment in shuffleArray …. Your vocabulary is slightly off, and the remarks about i going down to 0 and index being between 1 and 52 are inaccurate. However, that is an uninsightful, mechanical description of the code. A better comment would be:. For each element of the array except the first , starting from the end, pick any previous element or itself with uniform probability, and swap them. This technique is unbiased. For example, consider what happens during the first loop when shuffling a card deck.
Every card in the deck is equally likely to take the position of deckCards. With the last element deckCards thus fairly selected, repeat the process — randomly draw from the remaining card deck to fill its last element deckCards , and so on for the entire deck. Aces are only 11, but not 1. This means the player or the dealer could bust with just the two cards they're dealt.
Assuming they only had Aces, then it would be a bust with this code. I would add a check to see if the player is busting, but that one of the cards was dealt as an Ace. Possibly even creating a boolean, PlayerHasAce.
You would just need to make sure the boolean is set only ONCE per Ace though, and not repeated during the same hand. In addition to creating an object for Deck, an object for a player's hands and the dealer hand will also be useful.