1.0.5 • Published 3 years ago

poker-challenge v1.0.5

Weekly downloads
12
License
ISC
Repository
github
Last release
3 years ago

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.

1.0.5

3 years ago

1.0.4

3 years ago

1.0.2

3 years ago

1.0.1

3 years ago

1.0.0

3 years ago