Game time!
Methods to research:
each_with_index
max
shuffle
Tasks:
-
Build a deck of shuffled cards.
- The deck should be an array of cards.
- Each card should be a mini-array with a value and suit. Example:
[8, "hearts"]
- Shuffle the deck. It would look something like this...
deck = [ [8, "hearts"], [2, "diamonds"], ["J", "clubs"], ... ]
- NOTE: do not hardcode the deck. Create it by performing methods on the two arrays in the starter code.
-
Collect an array of player names by prompting:
- "{n} players so far. Enter a player name, or type 'play':"
-
Upon "play", deal each player a card.
-
Find the highest card score dealt (Aces high).
-
Find the winning player name, then print out:
- "Winner(s): {name1, name2, …}!"
Print out one of the following outcomes:
- "The winner is {name}!"
- "It's a tie between {name1, name2, …}!"
Have the game redraw cards for all players in the case of a tie.