Question: JavaScript War Card Game (High Card Wins) Purpose: A simulation of the card game War played with deck shuffling and card counting, until one player
JavaScript War Card Game (High Card Wins) Purpose: A simulation of the card game War played with deck shuffling and card counting, until one player wins all the cards. -Ace is highest card, two is the lowest. -Use a button to begin the game. -Add a timer to the play. -Cards are shuffled and assigned to the two players (the computer and the player). -Play all four suits (standard deck of cards; 52 cards) -Display the players cards after shuffle -For each hand, the next card in the deck is played. -Let the player pick the next card. -If card values are equal, the cards are added to a hold array. -If card values are unequal, both cards played are added to the player's winnings array, as are any cards in the hold area. -If a player runs out of cards, the cards in the winnings array are transferred to the player's hand. -No score is kept. The game is played until one player has all the cards.

//declare additional variables var cardName1, cardName2; var cardPointsi, cardPoints2; / card points player 1 and player 2 var numPlays = 0; var p|Points = 0; var p2Points = 0; var player! = "House". // could prompt for player names var player2 = "Player". // card played player 1 and player 2 // # of plays in game //tally points //Play as long as each player has cards while CnumPlays
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
