Blackjack

This is a discussion on Blackjack within the C++ Programming forums, part of the General Programming Boards category; Did you unzip all three of the files into the folder and then try compiling it? It looks like you ...

  1. #46
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Did you unzip all three of the files into the folder and then try compiling it? It looks like you are trying to compile a temporary file. Also, theres no main function so nothing will happen if you run it, you'll need to create a test main to try the classes out.

  2. #47
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    mind if I see your driver program
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  3. #48
    Cheesy Poofs! PJYelton's Avatar
    Join Date
    Sep 2002
    Location
    Boulder
    Posts
    1,728
    Don't really have a driver program with this, I used them to create a couple of games like cribbage and poker awhile back. To get a feel for what they can do, do something like this:
    Code:
    int main()
    {
    	srand(time(NULL));  // make sure you #include time.h
    	deckOfCards myDeck;
    
    	myDeck.shuffle();
    
    	hand h;
    
    	for (int x=0; x<10; x++)
    		h.addCard(myDeck.returnTopCard());
    
    	h.display();
    	h.displayBack();
    
    	h.sortByValue();
    	h.display();
    	h.sortBySuit();
    	h.display();
    
    	cin.get();
    
    	return 0;
    }
    Real easy to try out the other functions, just look at the name in the header file and test them out to see what they do.

  4. #49
    [T]
    [T] is offline
    Registered User [T]'s Avatar
    Join Date
    Aug 2004
    Posts
    2
    Hey the Brain, was wondering if you are planning on releasing the sc when done
    ?

  5. #50
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903

    Thumbs up

    sending it your way via email big T


    btw is that "T" part of the template class....???
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  6. #51
    [T]
    [T] is offline
    Registered User [T]'s Avatar
    Join Date
    Aug 2004
    Posts
    2
    thnx m8

    i guess ill have to teach you women...

  7. #52
    Banned
    Join Date
    Mar 2004
    Posts
    37
    You know what'd be really cool...go to a website with blackjack 'systems', and simulate thousands of games where it follows the system, and record profits/losses.

    For example, this website: http://www.blackjackinfo.com/bjbse.php

  8. #53
    Anal comment spacer DominicTrix's Avatar
    Join Date
    Apr 2002
    Posts
    120
    Hi there guys, saw this post and was immediately drawn (GA attender here). I have a poker progrm out there being sold at the mo which I wrote in C using structs instead of classes and am in the process of writing a version 2 in C++. Thought you might like to see my way of thinking for a few card classes (all the non poker specific one's )

    I have a class for a card and a base class for groups of cards from which I derive classes for decks, various poker hands etc. I've included those classes plus my deck class in the files attached. No singing and dancing ASCII grafix and a few extraneous methods I'm afraid (I'm frantically coding and refining as I go), but I'd be interested to see what you think or if you find anything useful.

    I think it's quite clear to read (over commented!)

    dt

    p.s. just saw the post about char 3-6, nice one!
    Attached Files Attached Files
    "The most important thing about acting is honesty. If you can fake that you've got it made" - George Burns

  9. #54
    Anal comment spacer DominicTrix's Avatar
    Join Date
    Apr 2002
    Posts
    120
    p.p.s

    the fully working version written in C is at www.frankscardroom.com (no source, but would be happy to supply some)

    dt
    "The most important thing about acting is honesty. If you can fake that you've got it made" - George Burns

  10. #55
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    awesome code.. (kinda advanced for me though)



    i think card games are a good way to try out different c++ methods and techniques
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  11. #56
    Anal comment spacer DominicTrix's Avatar
    Join Date
    Apr 2002
    Posts
    120
    Yeah, I agree, I had barely any experience before I wrote my first poker game, basically learned everything as I went along (with the wonderful help from this board).

    I'm now learning C++ on version 2! Its sad, but I find it so much fun creating 'real' objects through code, very satisfying! Going for my medication now, lalalala....

    dt
    "The most important thing about acting is honesty. If you can fake that you've got it made" - George Burns

  12. #57
    Teenage Mutant Ninja Nerd MMD_Lynx's Avatar
    Join Date
    Aug 2004
    Posts
    65
    gah, Player class isn't working. I don't have the program with me, but once I do I'll post it to find the problem. There is not compiler problem, but when I run, there's an error.

    Player class has...
    Code:
    char *name;
    CARD *cards[5]; //you can only have 5 cards in blackjack (5 cards = auto win)
    and a few funcs (teehee func is like funk)
    Code:
    int GetScore(void);
    Player(char *pname);
    but when I declare the two players (player and computer) it crashes...kinda
    Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.

    Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.

  13. #58
    Anal comment spacer DominicTrix's Avatar
    Join Date
    Apr 2002
    Posts
    120
    CARD *cards[5]; //you can only have 5 cards in blackjack (5 cards = auto win)
    Very friendly blackjack! If you want to be proper thorough you might want to look at some casino blackjack rules (I don't really advise going anywhere near online money casino's to get them tho!). There are some here: http://www.blackjackinfo.com/blackjack-rules.php#3.5

    You'd need to take splitting, doubling down and insurance into account. It would add a nice challenge after you've succeeded in making the basic game work.

    Just a thought.

    dt
    "The most important thing about acting is honesty. If you can fake that you've got it made" - George Burns

  14. #59
    Teenage Mutant Ninja Nerd MMD_Lynx's Avatar
    Join Date
    Aug 2004
    Posts
    65
    im pretty sure u win if u have 5 cards. i may be wrong. im not worried about splitting yet. doubling shouldn't be too hard. just deal one card and move to the computer's turn.
    Stupid people are useful. You can make them do all the mindless tasks you are too lazy to do yourself.

    Sphynx cats are just bald and wrinkly, like old people, and we don't reject them.

  15. #60
    Anal comment spacer DominicTrix's Avatar
    Join Date
    Apr 2002
    Posts
    120
    I guess it depends on where you play, I've drawn six cards before and still lost! It shifts the odds against them winning too much I should think. It's a nice rule though, makes it more fun.
    "The most important thing about acting is honesty. If you can fake that you've got it made" - George Burns

Page 4 of 5 FirstFirst 12345 LastLast
Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Simple Blackjack Program
    By saber1357 in forum C Programming
    Replies: 1
    Last Post: 03-28-2009, 03:19 PM
  2. Help with Blackjack program
    By sugie in forum C++ Programming
    Replies: 1
    Last Post: 04-30-2005, 12:30 AM
  3. Blackjack!
    By Dr. Bebop in forum Game Programming
    Replies: 1
    Last Post: 10-03-2002, 08:58 PM
  4. Blackjack
    By the_head in forum C Programming
    Replies: 1
    Last Post: 08-03-2002, 08:57 AM
  5. BlackJack Program...
    By 67stangman in forum C++ Programming
    Replies: 3
    Last Post: 05-06-2002, 10:44 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21