npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

poker-challenge

v1.0.5

Published

A package with a set of classes and functions for creating base poker games

Downloads

4

Readme

Poker Challenge

Terminology

  • Deck of cards - A "standard" deck of playing cards consists of 52 Cards in each of the 4 suits of Spades, Hearts, Diamonds, and Clubs. Each suit contains 13
  • cards: Ace, 2, 3, 4, 5, 6, 7, 8, 9, 10, Jack, Queen, King.
  • Suits - Cards are catogorised in 4 suits: Spades, Hearts, Diamonds, and Clubs
  • Rank - the ranking of the individual cards, from high to low, is ace, king, queen, jack, 10, 9, 8, 7, 6, 5, 4, 3, 2.
  • Hand - A poker hand consists of five cards. In games where a player has more than five cards and selects five to form a poker hand, the remaining cards do not play any part in the ranking. Poker ranks are always based on five cards only.
  • Poker Hand Rankings - The categories of hand, is ranked from highest to lowest. Any hand in a higher category beats any hand in a lower category (so for example any three of a kind beats any two pairs):
    1. Royal Flush: This is the highest poker hand. It consists of ace, king, queen, jack and ten, all in the same suit. As all suits are equal, all royal flushes are equal.
    2. Straight Flush: Five cards of the same suit in sequence - such as clubJ-club10-club9-club8-club7. Between two straight flushes, the one containing the higher top card is higher.
    3. Four of a kind: Four cards of the same rank - such as four queens. The fifth card can be anything.
    4. Full House: This consists of three cards of one rank and two cards of another rank - for example three sevens and two tens (colloquially known as "sevens full" or more specifically "sevens on tens"). When comparing full houses, the rank of the three cards determines which is higher.
    5. Flush: Five cards of the same suit. When comparing two flushes, the highest card determines which is higher. If the highest cards are equal then the second highest card is compared; if those are equal too, then the third highest card, and so on.
    6. Straight: Five cards of mixed suits in sequence - for example spadeQ-diamondJ-heart10-spade9-8. When comparing two sequences, the one with the higher ranking top card is better.
    7. Three of a Kind: Three cards of the same rank plus two other cards. This combination is also known as Triplets or Trips. If you have to compare two threes of a kind where the sets of three are of equal rank, then the higher of the two remaining cards in each hand are compared, and if those are equal, the lower odd card is compared.
    8. Two Pairs: A pair is two cards of equal rank. In a hand with two pairs, the two pairs are of different ranks (otherwise you would have four of a kind), and there is an odd card to make the hand up to five cards.
    9. Pair: A pair is a hand with two cards of equal rank and three other cards which do not match these or each other. When comparing two such hands, the hand with the higher pair is better.
    10. High Card: Five cards which do not form any of the combinations listed above. When comparing two such hands, the one with the better highest card wins.

Installation

npm install poker-challenge

Usage

Create Game

import { GameRound } from 'poker-challenge';

const game = new GameRound;

Join game

first player will be assigned to be the dealer and will be responsible for deal card.

const playerDealer = game.join('DealerName');
game.join('caller1');
game.join('caller2');
game.join('caller3');

dealer can start game by calling

playerDealer.startGame();

dealer can deal card by calling

playerDealer.dealOneCard();

End game

dealer can end game by calling

playerDealer.endGame();

Game will be automatically ended when the card deck is empty.