Giter Club home page Giter Club logo

blackjack's Introduction

Blackjack

A node.js Blackjack library

blackjack's People

Contributors

vlek avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar

blackjack's Issues

Create deck module

A Deck is something that can be used for various card games, not just for blackjack.

To this end, it should be a module that we create outside of blackjack, but it can still be contained within the project.

The Deck should be made up of Card objects.

A card should have a Suit and a face value.

Things we should be able to do with a deck:

  • Pick a card
  • Shuffle the deck
  • Pick a random card

Nice-to-have's:

  • Add decks together (Using an overloaded addition operator)

Add 'bj' parent command

All subcommands should happen under the bj command so that we do not have stray hit and stand commands (unless we actually want it that way?)

So, how you'd use it is like this:
bj hit
bj stand
bj (for help)
bj -h / --help (for help)
bj stats

Update README with new information

This is a new thing!

Going to need to explain what this is, how to use it, and whether we want any feedback/helpers on the project.

Will also be nice to add some badges, too!

Add 'hit' subcommand

In order to start a game of blackjack, we need to be able to say hit.

This should do different things based on whether we have already initialized a game:

  • Game not started:
    • Initializes a game, and:
      • If the player has 21:
        • States Blackjack and plays dealer's turn
      • Else:
        • Gives 'hit or stay?' message
  • Game started:
    • The player will be given an additional card:
      • If they are < 21:
        • Gives the 'hit or stay?' message
      • If at 21:
        • Plays the dealer's turn, ends the game
      • If over 22:
        • Gives the 'You lose' message

All should display the current state of the game first beforehand:
Player: :
Dealer: ?: ?

Saving stats information

In order to do #6, we need to first be able to save that information when playing the game.

Regardless of what the end-stage is for a game, it should go through a stats collection stage.

This stats collection should:

  • Look for a stats json file
    • If one is not present, create the base stats object.
    • Else, read the data from the file
  • Increment the data for the game:
  • Number of games played
  • Wins/loses/draws depending on outcome
    • If win, update current winning streak.
      • If current winning streak > longest winning streak:
        • Update longest winning streak.
  • Blackjacks
  • Update last played to now

Add 'stats' subcommand

The player should be presented with the stats that have been saved for them:

  • Times played
  • Wins
  • Loses
  • Draws
  • Blackjacks
  • Current winning streak
  • Longest winning streak
  • Last time played

Add 'stand' subcommand

There are two things that should happen when the stand subcommand is used:

  • A game is in progress:
    • The game should be played out with the dealer's turn.
      • If the player wins:
        • A win message should be given
      • If the player loses:
        • A lose message should be given
      • If the player draws:
        • A draw message should be given
  • A game was not in progress:
    • The player should be told to use 'hit' to start a new game.

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.