New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details → →
Socket
Book a DemoSign in
Socket

@nickgraffis/blackjack

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@nickgraffis/blackjack

šŸƒBlack Jack

latest
Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

BlackJack

šŸƒ Black Jack!

Demo

~> npm install -g @nickgraffis/blackjack
~> blackjack

Game Play

Try to get the highest card total without going over 21. 2 - 9 is face value ['šŸƒ', 'šŸ‘ø', '🤓'] are all 10 'A' is 11 or 1 if you bust 'A' + ['šŸƒ', 'šŸ‘ø', '🤓'] is Black Jack! Automatic winner Dealer will not hit past 17 Tie goes to the house :(

How it works?

Pretty simple and straight forward, except the recursive design of the computers hand.

var computerAsyncHand = function() {
  if (computerTurn < 2) {
    computerHand.push(randomPoints());
    computerTurn++;
    computerHand.push(randomPoints());
    computerTurn++;
    console.log(dealCard(computerHand[0], randomInt(4)));
    console.log(dealCard(computerHand[1], randomInt(4)));
    console.log(computerHand.reduce((a, b) => a + b, 0));
    sleep(1000);
  }
  if (computerHand.includes(11)) {
    var Ace = computerHand.indexOf(11);
    computerHand[Ace] = 1;
    console.log('Dealer score is now ' + computerHand.reduce((a, b) => a + b, 0) + ', using the A as a 1!');
  }
  if (computerHand.reduce((a, b) => a + b, 0) > 17) {
    //Game Over
    return;
  } else {
    computerHand.push(randomPoints());
    computerTurn++;
    console.log(dealCard(computerHand[computerTurn - 1], randomInt(4)));
    console.log(computerHand.reduce((a, b) => a + b, 0));
  }
  sleep(1000);
  computerAsyncHand();
}

Keywords

black

FAQs

Package last updated on 20 Sep 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts