Making a Blackjack program

Discussion in 'Programming' started by netsurfer802, Jul 9, 2009.

  1. netsurfer802

    netsurfer802 New Member

    Joined:
    Jul 9, 2009
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    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.
     
  2. vikas1234

    vikas1234 New Member

    Joined:
    Aug 21, 2008
    Messages:
    18
    Likes Received:
    0
    Trophy Points:
    0
    you can download the code .. making it from scratch would be tough .... go googling
     
  3. xpi0t0s

    xpi0t0s Mentor

    Joined:
    Aug 6, 2004
    Messages:
    3,009
    Likes Received:
    203
    Trophy Points:
    63
    Occupation:
    Senior Support Engineer
    Location:
    England
    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.
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice