Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Create two parallel arrays that represent a standard deck of 5 2 playing cards. One array is numeric and holds the values 1 through 1
Create two parallel arrays that represent a standard deck of playing cards. One array is numeric and holds the values through representing Ace, through Jack, Queen, and King The other array is a string array that holds suits Clubs Diamonds, Hearts, and Spades Create the arrays so that all cards are represented. Then, create a War card game that randomly selects two cards one for the player and one for the computer and declares a winner or a tie based on the numeric value of the two cards. The game should last for rounds and use a full deck with no repeated cards. For this game, assume that the lowest card is the Ace. Display the values of the players and computers cards, compare their values, and determine the winner. When all the cards in the deck are exhausted, display a count of the number of times the player wins, the number of times the computer wins, and the number of ties. Here are some hints:
Start by creating an array of all playing cards.
Select a random number for the deck position of the players first card and assign the card at that array position to the player. Move every higherpositioned card in the deck down one to fill in the gap. In other words, if the players first random number is select the card at position both the numeric value and the string move the card that was in position to position and move the card that was in position to position Only cards remain in the deck after the players first card is dealt, so the availablecard array is smaller by one.
In the same way, randomly select a card for the computer and remove the card from the deck.
You must use the following declarations in your Pseudocode
num x
num y
num limit
num index
num playerCard
num playerCardNum
num computerCard
num computerCardNum
num playerWin
num computerWin
num tie
string playerCardSuit
string computerCardSuit
num LENGTH
num GROUPS
num ROUNDS
num BOUNDSGROUPS
num cardsLENGTH
string SUITSGROUPS "Clubs "Diamonds "Hearts "Spades
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started