r/javaScriptStudyGroup • u/KRIOS97 • Nov 27 '17
JavaScript Challenge
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.
Cards are shuffled and assigned to the two players.
Required: play all four suits
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. Use a button to begin the game. Add a timer to the play.
Challenge ends December 3rd at 11:59pm eastern
1
u/theogjpeezy Nov 27 '17
This is my quick hit attempt. I think there are some improvements that can still be made on this one, but it does the stuff requested I believe.
https://gist.github.com/theogjpeezy/29ecf53a943ada5264de23a4cece1d88