Coder Social home page Coder Social logo

high_card's Introduction

Let's Play High-Card-Wins

Game time!

Methods to research:

  • each_with_index
  • max
  • shuffle

Tasks:

  1. 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.
  2. Collect an array of player names by prompting:

    • "{n} players so far. Enter a player name, or type 'play':"
  3. Upon "play", deal each player a card.

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

  5. Find the winning player name, then print out:

    • "Winner(s): {name1, name2, …}!"

Bonus I

Print out one of the following outcomes:

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

Bonus II

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

high_card's People

Contributors

amaseda avatar hewity avatar mattscilipoti avatar robertakarobin avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.