POKER

 

The existing code, from "A Book on C", pgs.419-421, is used as a template. From this the following must be accomplished

OPTIONS:

  1. Quiting the game:

 

  

2)Dealing a Hand:

-computer and player are dealt hands

-ante is $10.00

-user has 2 options

    1. place a bet
    2. fold

Place a bet

Fold

-user prompted for an amount

-computer matches the bet

-hands are evaluated

-player with biggest hand wins the bet

-if tie, neither side loses money

-amount of money won or lost by both sides is tracked and

displayed by program

-new hand dealt

-the player loses $10.00, the ante

-new hand dealt

  1. Cards are shuffled after each hand
  2. Hands should be aesthetically pleasing
  3. Computer’s hand will not be shown to the user until the user has entered the bet or player has folded.

 

 

-Would you like to deal a hand?

If no:

printf "thank you"

Exit program

If yes:

program deals a hand for the computer and the user.

1)shuffles cards by swaping deck (1-52)

2)deals by giving each player 5 cards from shuffle

-Would you like to bet or fold?

If fold:

-user loses $10.00

-Computer records loss

- New deal

If bet:

-user places a bet

-User’s bet is recorded

-Computer matches bet, and is recorded

-Hands are evaluated:

each kind is evaluated seperately and in order from top down until kind matches hand

Royal Flush, StraightFlush, Four of a kind, Full House, Flush, Straight, Three of a Kind, Two Pair, One Pair, No Value

-highest hand wins the ante – is recorded

-Loser, loses bet – is recorded

-Tie – no one loses money – is recorded

 

 

Hearts, Spades, Diamonds, Clubs are aliased as cdhs-------------------to be changed to suit

A STRUCT is used to define a card, made up of pips and suits.

Data Type: pips - integer

suit – cdhs

  1. where/how is data type cdhs defined, other than as an alias for H, S, D, C)

STRUCT ‘card’ is then aliased using typedef , to "card’.

All functions necessary are defined. (See necessary functions, section).

 

 

 

 

Back | HOME | Next




Canpol Solutions Przeszukaj Katalog -- przeszukaj katalog / zamowienia, komentarze --  Poczta Polonijnej Witryny

Internet ExplorerUzywaj zawsze najnowszej przegladarki
M.I.E. lub, ewentualnie Netscape ktorej, niestety na razie nie polecamy..
Netscape


Canpol Solutions © Polonijna Witryna