Skip to content

Instantly share code, notes, and snippets.

@BritneyJo
Last active June 28, 2018 19:29
Show Gist options
  • Save BritneyJo/c06b133817682f48b4948e3d3becf6d7 to your computer and use it in GitHub Desktop.
Save BritneyJo/c06b133817682f48b4948e3d3becf6d7 to your computer and use it in GitHub Desktop.
Lab: High Card Front-End JS Challenge

Let's Play High-Card-Wins

Game time! You are being tasked over the next 2 days to build another JavaScript game, High-Card! The winner is whoever has the highest card.

Coding Rules

For this Front-End Challenge you will not be using any outside resources other than class lesson notes and your brain. This means you'll need to start small and break this challenge into tiny manageable pieces. You already know everything necessary to complete this game; the tricky part here is going to be problem solving. Do not work on any CSS until the game functions properly. If there is time left, you can add styles Bonus V.

Tasks:

  1. Build a deck of shuffled cards.

    NOTE: do not hardcode the deck. Create it with a function that takes in a cards array.

  2. Collect an array of player names from the DOM.

    Should look like this: [{name:'Jesse'}, {name:'Jane'}]

  3. Upon "play", deal each player a card.

  4. Find the highest card score dealt (Aces high).

  5. Announce the winning player!


Bonus I

Take into consideration a tie by announcing one of the following outcomes:

  • "The winner is ${name}!"
  • "It's a tie between ${name1} and ${name2}!"

Bonus II

Allow the game to work for more than 2 players.

Bonus III

Have the game redraw cards for all players in the case of a tie.

Bonus IV

Persist the scores so there are games instead of just rounds.

Bonus V

CSS animations! Make those cards flyyy!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment