Create a simplified version of the card game poker

Assignment Help Basic Computer Science
Reference no: EM131396119

Create a simplified version of the card game poker. Reuse the fillDeck()and selectCard()functions from Exercise 19 to create an array of 52 cards and randomly deal five cards each to two players-the computer and the user. Create another function that determines the winner of the poker hand. In this simplified version, a player with the most matching cards wins. In other words, a player with a pair beats a player with no pairs, and a player with three of a kind, beats a player with just a pair. In this simplified version, straights and flushes do not matter. If both players have the same number of matches, then the hand is considered to be a tie. Save the program as SimplifiedPokerCardGame.cpp.

Exercise 19:

In the card game War, a deck of playing cards is divided between two players. Each player exposes a card and the player who exposes the card with the higher value, wins (that is, takes possession of ) both exposed cards. Create a computerized game of War in which a standard 52-card deck consisting of 13 values in each of four suits is randomly divided between two players. Reveal one card for the computer and one card for the player at a time. Score 2 points for the opponent holding the card with the higher value. (For this game the king is the highest card, followed by the queen and jack, then the numbers 10 down to 2, and the ace is lowest.) If the computer and the player are tied, score one point for each. At the end of the game, all cards should have been played with no repetition. That is, if the queen of hearts has been played in a game, it cannot be played again. At the end of the game, the sum of the player's score and the computer's score will be 52
Use an array of 52 integers to store unique values for each of the 52 playing cards. Write a function named fillDeck()that places 52 unique values into this array. Write another function named selectCard()that you call twice on each deal to uniquely select one card for each player, with no repetition of cards in 26 deals.

Figure 6-41 shows the start of a typical program execution. By the end of the game, 26 hands will have been dealt and a total of 52 cards will have been acquired by the two players.

Save the program as WarCardGame.cpp. Caution: This is a difficult exercise!

2215_8cd9aefd-4ec6-40d0-bc6b-6df48fa96f55.png

Reference no: EM131396119

Questions Cloud

Analyze the data with x2 and write a conclusion : To find the expected frequencies, think about the chance of being correct or incorrect when there are three possible outcomes. Analyze the data with x2 and write a conclusion.
Results of the different surveys : reveal how much they value the extra police, but it says that everyone will pay the same amount if the police are hired, provided that the sum of the personal valuations exceeds $75 million.
Analyze some of the php web applications we created : This exercise will walk you through Launching ZAP and allow you to become comfortable with the GUI for ZAP within your virtual machine. We will use ZAP to begin to analyze some of the PHP Web applications we created in week 4.
What are the common negotiation pitfalls : Using a practical example, what are the benefits and potential problems associated with conflict and What is negotiation? What are the common negotiation pitfalls? What are the strategies to overcome them?
Create a simplified version of the card game poker : Figure 6-41 shows the start of a typical program execution. By the end of the game, 26 hands will have been dealt and a total of 52 cards will have been acquired by the two players.
What happened to the twin decits hypothesis : Do you agree? Why or why not? According to Krugman, how do you explain the fact that since the nancial crisis the US government budget decit has exploded, yet at the same time the US Current Account decit has actually decreased. What happened to t..
Evaluate contemporary applications of psychological theory : Prior to beginning work on this discussion, read the required chapters from the Harré (2006) Key Thinkers in Psychology e-book. Examine one of the schools of thought (psychoanalysis, behaviorism, etc.) presented in the reading that is significant ..
Exercising illegal monopoly power : "Several years ago there were a few lawsuits contending that Microsoft was exercising illegal monopoly power when it required computer manufacturers who installed Windows to include Internet Explorer.
Conduct test and write a sentence summary of your conclusion : He decided to see if the results of the evening fit an "unbiased dice" model. Conduct the test and write a sentence summary of your conclusions.

Reviews

Write a Review

Basic Computer Science Questions & Answers

  Separation-deprivation or privation in childhood

What are the possible long term implications for children who have experienced separation, deprivation or privation in childhood? Refer to research in your answer.

  What is the perimeter of this triangular plot of land

A landscaper wants to plant begonias along the edges of a triangular plot of land in Winton Woods Park. Two of the angles of the triangle measure 95° and 40°. The side between these two angles is 80 feet long.

  Write a java program to display below layout

Write a TestLoanAppPanel class to test.Write a java program to display below layout

  Develop the function all-fed

Develop the function all-fed. It consumes a list of animals, as defined in exercise 41.2.8, and modifies them so that their field for morning feedings is switched to true.

  Find the dimensions of the new container

The specifications for a new cardboard container require that the width for the container be 4 inches less than the length and the height be 1 inch less than twice the length.

  Find the price of a call option struck at zero

There are no interest rates. An asset is worth zero today and goes up or down by 1 each day. Find the price of a call option struck at zero as a function of the number of steps to expiry.

  What is the shortest period that you can measure

Crank up the frequency until the measurement becomes inaccurate. What is the shortest period that you can measure?

  Difference between base and derived relation

What is the difference between base and derived relation?

  What type of relationship is proposed

What factors might you consider in deciding whether to use the experimental or non-experimental method to study the relationship between work stress and family conflict?

  Show that the class of turing reductions is transitive

The class of polynomial-time Turing reductions are Turing reductions in which the OTM runs in time polynomial in the length of its input. Show that the class of Turing reductions is transitive.

  What are the resonance peaks of each system

What are the resonance peaks of each system?

  Create a file that contains your favorite movie quote

To discover a file's size, you can create a System.IO.FileInfo object using a statement such as the following, where FILE_NAME is a string that contains the name of the file:

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd