Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

x.Hmze=\"3\">Introdution: Assignmentis to write a video blackjack program. Theco

ID: 3618213 • Letter: X

Question

x.Hmze="3">Introdution:

Assignmentis to write a video blackjack program.
Theconventional game is played between two players as follows.
Each player takes three cards from the deck. They thenadd up
the points in their respectivehands. The point value of a card
whosedenomination is between two and ten is simply the denomination
of the card. For example, the point value of the ‘fourof clubs’
is four points. The pointvalue of a face card (i.e., Jack, Queen or King)
is ten points, and the point value of an Ace is elevenpoints.




The player whose pointtotal is closest to 21 without going over is the winner.
If both players exceed 21 points or if they have thesame point value, there is no winner.In addition, if exactly oneof the players exceeds 21, the other player is the winner.Wewill change the rules a bit. In our version -- there exist 1 dealer and1 player in the game. The dealer draws one card and shows it to the player.The player draws two cards. Then, the player can choose to hit (takeanother card)

or stand (finish the turn). The goal is tocome as close to 21
(summing the cardvalues)as possible without going over. Once the
player stands,the dealer draws cards.The dealer automatically hits
if the sumof his/her hand is less than or equal to 16 andstands at
17 orabove. Once the dealer stands, dealer and player compare the
sumsof their hands.The one with the larger sum wins. If there is a
tie,nobody wins (no money gained/lost).

So you are writing acomputer program to behave as the dealer.
Theperson using the program will be the player.
Thisis a one player game against a computer dealer.
The input/output is open ended on this problem, but itshould have

the following features:

When the programloads, first ask the player to enter a dollar amount
(thisrepresents the player's total cash)
Then, draw a random card forthe dealer and show it to the user (and keep track of it)
Drawtwo cards for the player, display them and print the sum.
Askthe player to HIT or STAND (repeat if necessary)
If the player's total ever goes above 21,player loses
If the playerSTANDs at any point, you should draw cards
forthe dealer as described above.
The dealer loses if the totalgoes over 21. Otherwise,
compare the totals of the user andplayer.
The one with the bigger total wins.
Assume aplayer bets $5 each time.
So a loss costs the player $5 while awin gains $5
Allow the player to keep playing (loop).
Workingexample should look something like this:
How much money are youbringing: 85,
Dealer has 8, (make sure you display the card)
Playerhas 4, (make sure you display the card)
HIT or STAND: HIT,
Playerhas 10, (make sure you display the card)
HIT or STAND: HIT
Playerhas 20, (make sure you display the card)
HIT or STAND: STAND
Dealerhas 12, (make sure you display the card)
Dealer has 18, (makesure you display the card)
Player wins! ($90 total)
Above,anything after a colon was entered by the player.
Also, thefirst "Player has" line must have drawn TWO cards.
Don't forgetthat.
I want your implementation to create and use the followingfunctions:
void displayCard(appropriate args) This methoddisplays the calling
card in the traditional way, for example,‘ace of hearts’, ‘two of diamonds’, etc.
void fillDeck( Card *const wDeck, const char * wFace[],
const char * wSuit[] ) Thismethod fills the deck.
void shuffle(Card * const wDeck ) Thismethod shuffles the calling deck.
void takeACard(Card * constwDeck) This method causes the calling player to
take one cardfrom the top of the deck d and insert the card at position
numOfCardsin his or her hand. The value of numOfCards is then updated.
intcomputePoints(appropriate args)This method causes the calling player to
computeand return the point value of his or her hand.
voidshowHand(appropriate args)
This method will cause the calling player
toprint out his or her hand and the point value of the hand.
voiddiscardHand(appropriate args) This method causes the calling player
todiscard his or her hand.
int whoWins(Player p1, Player p2) Thismethod decides whether player 1 or
player 2 has won the game. Themethod returns 1 if player 1 wins and returns
2 if player 2wins. Otherwise, it returns 3 (in case of a tie or if both players areover 21).

Remember to use the code that we have alreadydeveloped.


------Use thefollowing skeleton for the main program:-------------







#include <stdio.h>
#include <stdlib.h>
#include<time.h>

/*card structure definition*/              

struct
card{                                
   const char *face; /*definepointer face */

   const char *suit; /* define pointer
suit*/

}; /* end structure card */                  

typedef structcard Card; /* new type name for struct card */

/* prototypes */

void fillDeck( Card * const wDeck,
constchar * wFace[],

   const char * wSuit[] );

void
shuffle(Card * const wDeck );

int main()

{

Carddeck[ 52 ]; /* define array of Cards */

   /* initialize array of pointers */

constchar *face[] = { "Ace", "Deuce", "Three", "Four", "Five",

     
"Six","Seven", "Eight", "Nine", "Ten",

"Jack", "Queen","King"};

/* initialize array of pointers*/

   const char *suit[] = {
"Hearts", "Diamonds", "Clubs","Spades"};

   srand( time(NULL ) ); /* randomize */

  fillDeck( deck, face, suit );

shuffle( deck );

   return 0;
}
voidfillDeck( Card *
const wDeck, const char * wFace[],
   const char * wSuit[] )
{
  

Explanation / Answer

please rate - thanks to get you started #include #include #include #include void deal(int,int*); void deal2(int,int*,int*); int getbet(int); int main() { int totdealer,totplayer; int money,bet,aces; char yesno='Y'; int again; srand(time(0)); printf("How much money do you have? "); scanf("%d",&money); while(money>0&&yesno=='Y') {bet=getbet(money); totdealer=0; deal(2,&totdealer); aces=0; totplayer=0; deal2(2,&aces,&totplayer); printf("Your total is %d ",totplayer); printf("You have %d aces",aces); again=0; while(totdealer21)       money-=bet; else if(totdealer21)     if(*aces==0)          return;     else         {*aces=*aces-1;         *tot=*tot-10;         } } int getbet(int money) {int bet; printf("You have $%d enter your bet: ",money); scanf("%d",&bet); while(bet>money)     {printf("You cannot bet more then youhave!!! ");      printf("You have $%d enter your bet:",money);      scanf("%d",&bet);      } while(fgetc( stdin ) != ' ');    return bet; }