Would be nice to show dealers cards after 'Stand'ing.
Also, would be more realistic if the same card did not keep showing up.
Could create the full shuffled deck, removing used cards during play, until cards remaining is less than 12 or so, then remove all cards, and create a new shuffled deck.
Thanks for the feedback! I've solved the problem with the same cards showing up so often. It used to rebuild the deck at each new deal because if you ran out of cards from the deck while playing it would give a NullPointer Error but the new version will check every time you take an action if the deck is empty and refresh it. I still haven't figured out how to show the cards after the win/loose message and how to make them float :). I'll keep working on it ... If anyone has any ideas about those two things and wishes to share them with me leave a comment :).
A new version of this scenario was uploaded on Wed Mar 14 14:13:15 UTC 2012
Fixed the deck refreshing at each new deal so you don't get the same cards as often.
The card deck should remain constant (as per a real deck); look into holding in an array. In fact, several packs could be used. In this way, card counting 'could' be used as a tactic. If I keep hitting, I should see Lose come up if I go over 21. Not happening at the moemnt.
Well the deck doesn't have to remain constant considering a real game of blackjack is played with multiple decks which get shuffled, I might just add more stacks :) cause thats what I used to implement the deck and pick cards randomly from them so in that case you can get the same card in a draw :D. Won't putting them in an array result in a ton of iterations through it even in an ArrayList?. I'll put a bustCheck in the Hit button so it busts you if you go over 21 while hitting rather that when you stand and let the dealer finish drawing his cards.
If you used an array list though, you can deal from the top. After a hand, randomly add the cards in play to the end of the array. In that way, the cards remain constant. Every now and again you could shuffle up the entire pack. Just a thought. You don't need to loop or iterate through the array list because you just want to use a FIFO (first in first out) array. Does that make sense?
2012/3/13
2012/3/14
2012/3/14
2012/3/14
2012/3/14
2012/3/14
2012/3/14
2012/3/14
2012/5/23