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

Three physical locations distributed across the county

The Banana Tree Travel Agency is expanding from a single physical location to three physical locations distributed across the county to better serve the needs of their cu

Complete binary tree

Assume that the binary tree from Question (a) above is stored in an array-list as a complete binary tree as discussed in class. Specify the contents of such an array-list fo

Define an array of 10 pointers to double-precision numbers

Next, have your program sum the numbers and store the result in a pointer-accessed location. Finally, have your program display the contents of all locations, again using po

Write the equation of the orbit of the satellite

Astronomy A satellite orbiting Earth follows an elliptical path with the center of Earth as one focus. The eccentricity of the orbit is 0.16, and the major axis is 10,440 mi

Complement to represent negative numbers

Add (-8) + (-7) in binary using 2's complement to represent negative numbers. Use a word length of 5 bits (including sign). Indicate if an overflow occurs. Enter your answer

Find an example of an accepted bad input

The transducers we designed in this chapter to evaluate postfix notation and to convert infix to postfix have a funny quirk: they can accept some bad input strings and proce

What form does time wait now take

What form does TIME WAIT now take? How would this be seen through the programming interface? Assume that a client socket could now be reconnected arbitrarily many times to a

Describe the role of data mining

Search for a relevant and/or timely article involving data mining. Describe the role of "data mining" in the story using your own words. Try to identify the type of data ana

Reviews

Write a Review

 
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