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. 

JavaScript War Card Game (High Card Wins) Purpose: A simulation of the

//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 cardPoints2) // player 1 wins hand document.writeC,"player1wins hand." BR); p1Points+t else if (cardPoints2 cardPoints1)player 2 wins hand document.writeC,"playerwins hand." + BR); p2Points+ else t // tie hand document.writeC", Tie hand.BR); // end while loop

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!