Coder Social home page Coder Social logo

texas-holdem-house's Introduction

Texas-holdem-house

A texas hold'em game engine for bot players

➜ npm i texas-holdem-house

Start Game

import { startGame, Player, CallPlayer, RandomPlayer } from 'texas-holdem-house'

const builtInPlayers = _.range(0, 7).map(i =>
  i < 4 ? new CallPlayer(`CallPlayer-${i}`) : new RandomPlayer(`RandomPlayer-${i}`),
)

// write your own bot
class MyPlayer implements Player {
  constructor(public name: string) {}
  // join the game with an event emitter to listen to game event
  join(event: EventEmitter, position: number): void {
    // your code
  }
  // deal two card to you
  deal(cards: [Card, Card]): void {
    // your code
  }
  // your turn to action
  async action(actionList: Action[]): Promise<Action> {
    // your code
    ...
  }
}

startGame([...builtInPlayers, new MyPlayer('MySeasonedPlayer')])

Texas hold'em rules

  • For clockwise direction dealder followed by small blind, big blind
  • deal from small blind
  • first round betting start from the one next to big blind, big blind is the last one to action, second/third/fourth round betting start from small blind
  • player can only raise multiple to previous bet

德州扑克规则

  • 顺时针,dealer 左边依次是小盲,大盲
  • 从小盲开始发牌
  • 第一轮从大盲左边一位开始行动,到大盲最后一个 call/raise,后面轮次从小盲开始行动
  • 每轮 raise 必须是 bet 的整数倍

texas-holdem-house's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.