1game-texas-holdem 中文文档教程

发布于 8年前 浏览 24 项目主页 更新于 3年前

Texas Hold'em by 1game

Travis BuildGithub 发布

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 

Texas Hold'em by 1game

Travis BuildGithub 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 
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文