Hey guys, I was just wondering how you could make a Blackjack program. I'm stuck on the beginning, and I don't know where to start. If one of you guys could help me, I would greatly appreciate it! Thanks guys!!
Printable View
Hey guys, I was just wondering how you could make a Blackjack program. I'm stuck on the beginning, and I don't know where to start. If one of you guys could help me, I would greatly appreciate it! Thanks guys!!
Well I think you'd need an array for all the card values. I'd probably use a String array and store then like 10Hearts, 9Spades, ect
then you'd have to have a random number generater that would select an element of the array by its number and deal that card, and you'd have to keep track (probably with another array) of which cards had already been delt, then if their element number came up you'd have to throw it out and go get a new one until you delt one that was valid.
Then you'd have to do the calculations to see if you went over 21 or how close you were. Then give the user the option of drawing another card or standing. The computer would need some type of AI to make the game interesting at all, but it could be pretty simple. Like only drawing another card if it was well below 21 on the first one.
The blackjack could work like they do in the casino, keep on taking cards till reach 17, if player ties with dealer, dealer wins... mmm.. need to add in a if or two to make the aces work
(I wish i didn`t just get a new computer and loose some of my earlier programs, or i would lend you my code from my old blackjack i made)
dear,
try out the cards32.dll, it's the basic for the ms freecell game
there are many links on the internet, e.g.
http://rookscape.com/vbgaming/tutU.php
regards,
big nell