Tags : JavaScript Intro

War Card Game

Create the card game of "War".

First create a deck of 52 cards and distribute them equally among the players. Remember to make this part random (look up Math.random and Math.floor methods).

The player with the highest card takes the other player's card and places it at the bottom of their deck.

If both players present the same value card, each player must draw 3 cards. The player with the highest card takes all the cards and places them at the bottom of their deck. If the highest cards of each player are of the same value, this action repeats itself until there is a winner.

If the player is has no cards left, they have lost the game.