Question: JavaScript assignment help (NO CSS code needed. Simple HTML is fine) Create an automated version of the classic card game WAR. Consider classes such as

JavaScript assignment help (NO CSS code needed. Simple HTML is fine)

Create an automated version of the classic card game WAR.

Consider classes such as Card, Deck, and Player and what fields and methods they might each have.

You can implement the game however youd like (i.e. printing to the console, using alert, or some other way). The completed project should, when ran, do the following:

:::Deal 26 Cards to two Players from a Deck.

:::Iterate through the turns where each Player plays a Card

:::The Player who played the higher card is awarded a point

:::Ties result in zero points for either Player

:::After all cards have been played, display the score.

:::Write Unit Tests using Mocha and Chai for each of the functions you write.

Here is a pseudo code block of what it should look like

instantiate new Deck

shuffle deck

instantiate 2 new Players

loop over cards in deck

deal one card to player1

deal one card to player2

end loop

loop through 26

card1 = player1.flip()

card2 = player2.flip()

if card1 value > card2 value

increase player1 score

else if card2 value > card1 value

increase player2 score

end if

end loop

if player1 score is greater than player2 score

show message player 1 wins

else if player2 score is greater than player1 score

show message player 2 wins

else

show message draw

end if

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!