There are two bugs in my Blackjack program. The first: it prints every card before the game starts. Buggery. The second: it draws the same card every time. Double buggery.
Ace of Hearts //first problem King of Spades Queen of Clubs Jack of Diamonds Ten of Hearts Nine of Spades Eight of Clubs Seven of Diamonds Six of Hearts Five of Spades Four of Clubs Three of Diamonds Two of Hearts Ace of Spades King of Clubs Queen of Diamonds Jack of Hearts Ten of Spades Nine of Clubs Eight of Diamonds Seven of Hearts Six of Spades Five of Clubs Four of Diamonds Three of Hearts Two of Spades Ace of Clubs King of Diamonds Queen of Hearts Jack of Spades Ten of Clubs Nine of Diamonds Eight of Hearts Seven of Spades Six of Clubs Five of Diamonds Four of Hearts Three of Spades Two of Clubs Ace of Diamonds King of Hearts Queen of Spades Jack of Clubs Ten of Diamonds Nine of Hearts Eight of Spades Seven of Clubs Six of Diamonds Five of Hearts Four of Spades Three of Clubs Two of Diamonds Player gets a Eight of Hearts //Look! It works! Dealer gets a Eight of Hearts //Wait, no it doesn't. Player gets a Eight of Hearts //BUGGERY. Dealer gets a card.
Would you like to take a hit or stand? (H/S) //I would like this program to work!
I don't know what parts of the code are affecting what. This is my second large program, and the vastness of it all tends to give me a headache. So here's the code in its entirity:
in the "shuffle()" loop would have something to do with problem 1, wouldn't you?
As far as dealing the same card every time: the card in the variable "temp" is the one that gets dealt; I don't see any code intended to change that, nor do I see any code which, even if different cards were being dealt, would prevent the same card from being dealt more than once (i.e., the deck always contains all the cards.)
The cards are shuffled, which means that I simply need to move on to the next card in the Array.
I have it in Array format:
That's how I figured this out... But I have no idea how to move on to the next card. GRRRR.
After many hours work, I was able to come up with the two lines of code required to make it move on to the next card. Wewt. [ November 10, 2006: Message edited by: Ricky Harline ] [ November 10, 2006: Message edited by: Ricky Harline ]