Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

In the card game War, a deck of playing cards is divided between two players. Ea

ID: 662209 • Letter: I

Question

In the card game War, a deck of playing cards is divided between two players.
Each player exposes a card; the player whose card has the higher value wins
possession of both exposed cards. Create a console-based computerized game
of War named WarCardGame in which a standard 52-card deck is randomly
divided between two players, one of which is the computer. Reveal one card for
the computer and one card for the player at a time. Award two points for the
player whose card has 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
finally the ace.) If the computer and player expose cards with equal values in the
same turn, award one point to each. At the end of the game, all 52 cards should
have been played only once, and the sum of the player

Explanation / Answer

using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WarCardGame { public partial class warForm : Form { static string[] cards = {"Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King"}; static string[] suits = {"clubs", "diamonds", "hearts", "spades"}; int[] shuffledDeck = new int[52]; static Random random = new Random(); static int counter = 0; public int eraseOutput = 0; public int playerScore = 0; public int compScore = 0; public int selectNum; String playerCard, computerCard, playerSuit, computerSuit; public warForm() { InitializeComponent(); dealButton.Visible = true; playButton.Visible = false; } public void FillDeck(object sender, EventArgs e) { bool foundCard = false; int card; dealButton.Visible = false; playButton.Visible = true; for (int i = 0; i compNum) { playerTotal += 2; playerScoreBox.Text = Convert.ToString(playerTotal); } else if (playerNum compScore) { outputTextBox.AppendText("YOU WIN!"); } else if (playerScore
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote