Thread: c programming blackjack

  1. #1
    Registered User
    Join Date
    Mar 2010
    Posts
    41

    Angry c programming blackjack

    i have been struggling to make a simple blackjack program using onyx and a compiler called "Putty". I am trying using arrays and loops with a random factor on the cards and using only one deck. Like i said i just want it to be simple. Im not looking for someone to write the whole thing but i was hoping someone could give me a good start on it. email me with something i can start with and i know i can finish it.i will be getting help from my professor but i just want a good start

  2. #2
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    okay, here is a start:
    Code:
    int main(void)
    {
            char cards[52] = {0};
            int i;
            while(stillplayingthegame){
                    deal_cards();
                    while(still_betting){
                            deal_one_card();
                            check_for_bust_for_each_player();
                            check_players_for_highest();
                    }
            }
    }

  3. #3
    Registered User
    Join Date
    Mar 2010
    Posts
    41
    lol thank you that kinda helped

  4. #4
    Registered User
    Join Date
    Sep 2006
    Posts
    8,868
    If you ask in a forum, you get answered in the forum, not email. imo

    Ask how many people are playing, or is this a set number?

    Generally, I like using structs for card games, and make an array of the card struct.

    Don't forget any round of betting or ante, that you want, doubling down, when the dealer has to take a hit, and when s/he won't, etc.

  5. #5
    {Jaxom,Imriel,Liam}'s Dad Kennedy's Avatar
    Join Date
    Aug 2006
    Location
    Alabama
    Posts
    1,065
    Quote Originally Posted by gloworm View Post
    lol thank you that kinda helped
    Dude, it wasn't a joke. I left most of the details out, yes, but those should be easy to complete. The only other thing I'll tell you is this: Like with what adak says, you could make a struct of cards, but you didn't say anything about structures, so I didn't go there. The other way to do it would be to #define things like SPADE_START 0 and SPADE_END 12 etc. This would allow you to know where you are for each one, then the cards array is just an is_used() type deal.

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 gsoft in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 01-04-2005, 01:09 PM
  4. Blackjack!
    By Dr. Bebop in forum Game Programming
    Replies: 1
    Last Post: 10-03-2002, 08:58 PM
  5. Blackjack
    By the_head in forum C Programming
    Replies: 1
    Last Post: 08-03-2002, 08:57 AM

Tags for this Thread