1.12.1 • Published 10 years ago

1game-texas-holdem v1.12.1

Weekly downloads
43
License
MIT
Repository
github
Last release
10 years ago

Texas Hold'em by 1game

Travis Build Github Release

Installation

npm i 1game-texas-holdem --save

Usage

import the library

var th = require('1game-texas-holdem');

starts a sample game

// sample game supports 0-11 players
var numOfPlayers = 5;
// API - `sample`
var new_sample = th.sample(numOfPlayers);
// reveal the Board
// sample game stores the Board as an array of 5 Cards.
var board = new_sample.board;
console.log('The Board: ', board);
// reveal the players' Hands
// sample game stores the players' Hands in a two-dimensional array.
var hands = new_sample.hands;
console.log('The Hands: ', hands);
// reveal the 5th Player's Hands
var playerIndex = 4;
var pHands = [ hands[0][playerIndex], hands[1][playerIndex] ];
console.log('The 5th Player\'s Hands: ', pHands);

counting

// after you retrieve the Hands and the Board.
// API - `rule` -> `count`
var input = pHands.concat(board);
var output = th.rule.count(input);
// show what the player hits
console.log(output.rank);
// show the related indexs of the `best` five cards.
console.log(output.ix);
// construct the value string
var val = th.rule.value(input, output);
console.log(val);

API

poker

  • SuitNames (Suits' Names)
  • StSuitNames (ShortNames for SuitNames)
  • RankNames (Ranks' Names)
  • StRankNames (ShortNames for RankNames)
  • Suits (4 Suits)
  • Ranks (13 Ranks from Ace to Two)
  • Deck (52 Cards in initial order)
  • Card (Card prototype)
  • Rank (Rank prototype)

rule

  • count (5 to 7 card hands evaluation)
  • rankings (Names for Hand Ranks)
  • value

sample

a simple game structure 
1.12.1

10 years ago

1.12.0

10 years ago

1.11.1

10 years ago

1.11.0

10 years ago

1.10.1

10 years ago

1.10.0

10 years ago

1.9.0

10 years ago

1.8.2

10 years ago

1.8.1

10 years ago

1.8.0

10 years ago

1.7.0

10 years ago

1.6.0

10 years ago

1.5.0

10 years ago

1.4.0

10 years ago

1.3.0

10 years ago

1.2.0

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago