Thread: Creating a blackjack game

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    *this
    Join Date
    Mar 2005
    Posts
    498

    Creating a blackjack game

    I need some guidance, i havent finished the pseudocode yet
    but i quickly (less than 20 mins) wrote some of my ideas, let me know if its a good start or if i should aproach it another way

    Code:
    /****************************
    
    Present the user interface
       Display welcome message
       Display options for game
          1 Enter ammount of computers to play with
             create a class object for each computer
          2 Enter ammount of humans to play with
             create a class object for each human
          3 Start Game
          4 Exit
       Input option
       
    ////////////////////////////////Cards Class///////////////////////////////////
    PUBLIC FUNCTIONS:   
           
    structure deckType
       contains: size of array and an array filled of cardsType
    structure for the cardsType
       contains: suit 
       card number
       bool type dealt (true if card is dealt to a player)
       
    Create a deck of cards     
       create a deckType
       fill deck with each card
          for each card number
             create a card for each suit
             
    Shuffle the deck of cards
       for many repetitions
          choose two random numbers in deck
          swap those locations
          
    Deal cards - function takes in: Array of player, and number to deal (X)
       choose first X numbers in deck that havent been dealt
       check for variables in the array
       resize array if necessary
       place dealt cards after current variables
       mark cards as "dealt" in the deck
       
    Number of cards dealt
       go through deck
          for each bool dealt = true
          add 1 to # cards dealt
       return # of cards dealt
       
    ______________________________________________________________________________
    
    ///////////////////////////////Dealer Class///////////////////////////////////
    include cards class
    
    PUBLIC FUNCTIONS:
    
    create a dealer
    ______________________________________________________________________________
       
    ///////////////////////////////Player Class///////////////////////////////////
    include cards class
    
    PUBLIC FUNCTIONS:
           
    create a player
    ______________________________________________________________________________
    
    
    Deal 2 cards to each player and dealer
    Have player 1 go first
    after each player
       dealers turn
    Calculate the winner
       if the dealer is the highest
          display "You Lose, Dealer Wins!"
       if a player has the highest
          display "Player X Wins!"
    Ask if user would like to play new game, change settings, or exit
    ******************************/
    Last edited by JoshR; 04-28-2005 at 10:12 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. 2D RPG Online Game Project. 30% Complete. To be released and marketed.
    By drallstars in forum Projects and Job Recruitment
    Replies: 2
    Last Post: 10-28-2006, 12:48 AM
  2. beach bar (sims type game)
    By DrKillPatient in forum Game Programming
    Replies: 1
    Last Post: 03-06-2006, 01:32 PM
  3. Game Engine Link Prob
    By swgh in forum Game Programming
    Replies: 2
    Last Post: 01-26-2006, 12:14 AM
  4. Blackjack (21) Game
    By Rabidpunk in forum Game Programming
    Replies: 12
    Last Post: 01-11-2002, 03:19 AM
  5. Blackjack (21) Game Pt. 2
    By Unregistered in forum Game Programming
    Replies: 0
    Last Post: 12-19-2001, 02:53 PM