Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Programming in C++ , SkatGame You should implement an object-oriented simulation of the card game 'Skat' and use this simulation to investigate some statistical questions.

Programming in C++ , SkatGame

image text in transcribed

You should implement an object-oriented simulation of the card game 'Skat' and use this simulation to investigate some statistical questions. (Note: You don't need to know the game of skat to do this. Everything you know this is the task.) Realize the class SkatGame and a supporting class

Card as described in the following class diagrams:

-->It is played with 32 cards, of which each of the three players receives 10 cards. The remaining two cards remain face down on the table ('Skat'). So the global constants for the array sizes have the values DECK_SIZE = 32, PLAYER_SIZE = 10 and SKAT_SIZE = 2.

-->A Card constructor is supposed to have the two attributes suit and face with values adopted from outside initialize for card color and card value.

According to the rules of the Skat game, the enumeration types o have the values { DIAMONDS = 0, HEARTS, Spades , Diamonds} for the card color (enum suit), o have the values { SEVEN = 0, EIGHT, NINE, TEN, JACK, QUEEN, KING, ACE} for the card value (enum face).

toString should return card color and card value of the card separated by a space as a single string (e.g. "Seven of Diamonds" or "Queen of Hearts").

The constructor of SkatGame should create all 32 different cards of a Skat game (i.e. all 4 card colors (Suit) with all 8 card values (Face ) and save them in the attribute deck.

Note: You can use loops with suitable int-values and cast the int-values in Suit or Face when passing them to the card constructor.

--> shuffle should mix the cards, i.e. put the 32 card objects in the array deck in a random order.

-->deal should completely split the 32 card objects in the array deck between the four arrays player1, player2, player3 and skat. The first three arrays should contain 10 of the card objects in deck and the remaining two card objects in skat after calling deal. After all cards are distributed, the arrays player1, player2 and player3 are sorted ascending within deal as follows:

All CLUBS cards are higher than all SPADES cards, these are higher than all HEARTS cards and these are higher than all DIAMONDS cards. Within each suit the order is ACE, KING, QUEEN, JACK, TEN, NINE, EIGHT and SEVEN (ACE highest and SEVEN lowest).

-->toString should return all card objects contained in the four arrays player1, player2, player3 and skat in a suitable format as string. Here you have to see how the 32 cards are distributed between the three players and the Skat (the two remaining cards).

-->getSkat should return the array skat, which contains two card objects, so that it can be used in the calling program.

Note 'const-correctness': All methods for which this is possible should be declared const. (This is not yet considered in the class diagrams!)

The application program (main) should perform the following activities:

-->Creation of a SkatGame object.

-->Execute the following sequence five times: shuffle, give and deal the cards, which cards the three Players and the skat have received.

-->Mix and give the cards 10,000 times and determine how often under the two cards of the Skat at least one BUBE is included. Enter the value obtained both as an absolute numerical value (e.g.:"In 10,000 games viewed, there is at least one jack in the skat in 2379 games.") As well as relative .Frequency in percent. (Example: "23.79 percent of the skat blades contain at least one jack in the skat.")

-->Shuffle and give the cards 10,000 times and determine how often both Skat BUBE cards are. Enter the value obtained both as an absolute numerical value and as a relative frequency in percent out.

Please answer if you only have knowdlege about this subject.

SkatGame Card - deck: array - player1: array - player2: array - player3: array - skat: array - suit: Suit - face: Face + Card() + Card (Suit, Face) + getSuit(): Suit + getFace (): Face + toString(): string + SkatGame () + shuffle () : void + deal(): void + toString(): string + getskat(): array SkatGame Card - deck: array - player1: array - player2: array - player3: array - skat: array - suit: Suit - face: Face + Card() + Card (Suit, Face) + getSuit(): Suit + getFace (): Face + toString(): string + SkatGame () + shuffle () : void + deal(): void + toString(): string + getskat(): array

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Building The Data Lakehouse

Authors: Bill Inmon ,Mary Levins ,Ranjeet Srivastava

1st Edition

1634629663, 978-1634629669

More Books

Students also viewed these Databases questions