Go4Expert (http://www.go4expert.com/)
-   Programming (http://www.go4expert.com/forums/programming-forum/)
-   -   Making a Blackjack program (http://www.go4expert.com/forums/blackjack-program-t18437/)

netsurfer802 9Jul2009 08:23

Making a Blackjack program
Hi I'm trying to either get or make a blackjack program that tests strategy over say a million hands etc and give me the wins or losses statistics of my systems over time.

If I'm going to make it, would prefer to get some pointers in making it with Excel, HTML or Visual Basic. I don't know the other programming languages well enough at all.

Thanks in advanced for any advice or pointers.

vikas1234 24Jul2009 14:48

Re: Making a Blackjack program
you can download the code .. making it from scratch would be tough .... go googling

xpi0t0s 24Jul2009 17:33

Re: Making a Blackjack program
I don't see that it would be particularly tough. All you need to do is find some representation for the cards, then pick two cards from a pack at random (making sure you don't pick the same card twice), then depending on your algorithm pick another card or stop, repeat until this terminates, see what the result was, then loop all the above 1,000,000 times and keep track of how many "wins" you get; that number divided by 1e6 will give you some kind of idea for how effective that algorithm is.

Additional complexities:
(1) does the algorithm involve card counting? If so then you can't pick two cards from a fresh pack each time, but every so often you will have to shuffle the discarded cards to make a new pile, or start with enough cards to cover all the hands in the simulation (say if a particular algorithm averages out to 3 cards/hand, then you need 3,000,000 cards or 57693 packs.
(2) does the algorithm involve other players and/or a banker hand? Again the number of cards will be affected by this.
(3) Or are the algorithms under test simple enough just to work by drawing cards directly from a fresh pile? If so then you only need one deck, of course.

Card representation is easy enough and you have several options including but not limited to:
- represent a card simply as a number from 1-52
- or as two numbers, one from 1-13 and one from 1-4
- or as two characters, say one each from A23456789TJQK and HCDS - 7 of clubs would be 7C; 10 of hearts TH and so on

Of course you can add stacks of complications to that, a graphical interface showing what's going on for instance, but that would really slow the simulation down and all you really want is the result of each algorithm.

All times are GMT +5.5. The time now is 15:36.