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

  Network diagram says eigrp

Network diagram says "EIGRP", but instructions are to use OSPF. Network diagram shows subinterface numbers as ".1", ".2" or ".3", but instructions say that the DLCI numbers ".102", ".103", etc, should always be used as the subin..

  Write and test an adding machine program

The program should stop when it gets an input that is 0, printing out the sum at that point. Use the SPIM system calls described on pages B-43 and B-45.

  Major activities of an operating system

What are the three major activities of an operating system in regard to memory management?

  Scrum vs plan-based software development strategies

Scrum vs. Plan-Based Software Development Strategies

  Create the savingaccount class

For this programming activity, you will create the SavingAccount class, which inherits directly from the bankaccount class. The savingsaccount class is similar to the checkingaccount class in that both classes inherit from bankaccount

  Construct a lift chart for the default cart model

Construct a lift chart for the default CART model. What is the estimated lift at 20%? 33%? 40%? 50%?

  Create a five-question multiplechoice quiz on global warming

if four, print "Very good"; if three or fewer, print "Time to brush up on your knowledge of global warming," and include a list of some of the websites where you found your facts.

  Discuss the reasons for this operation''s greater complexity

Class We i ght e dGr a ph in this chapter is to be extended to include a r e move Ve r - t e x operation, which removes a vertex from the graph. Deleting a vertex is more complicated than deleting an edge from the graph. Discuss the reasons for th..

  What constants are needed for block sizes of 64 and 128 bit

The second subkey is derived in the same manner from thefirst subkey.a. What constants are needed for block sizes of 64 and 128 bits?

  What is a downside of using bagging

How does bagging contribute to a reduction in the prediction error?

  Does the above solution work in a concurrent model

Does the above solution work in a concurrent model, i.e., when exchanges on the same cell are done concurrently? Is such a solution possible? In the light of this result, comment on the relationship between Is Det and explicit state.

  What is halon and why is its use restricted

List and describe the four classes of fire described in the text. Does the class of a fire dictate how to control the fire?

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