Giter Site home page Giter Site logo

poker-holdem-engine's Introduction

poker-holdem-engine

poker-holdem-engine provides an engine to play Texas Hold'em Poker in respect of the official rules.

It's used as default poker holdem engine for http://botpoker.org.

demo

It's possible to run a demo on your local machine by executing the npm run demo from the project root folder.

In order to make the demo works you need to specify a connection string for a mongodb instance.

start a tournament

const engine = require('poker-holdem-engine');

const tournamentID = 'botparty';
const players = [
  {
    id: 'r2',
    name: 'r2d2',
    bet: (gs) => betAmount
  },
  ...
];

engine.start(tournamentID, players);

Players should be object with at least the name, id, and bet properties specified.

The bet function is provided with the current game state and should return the desired bet amount.

Every time something of interesting happen the message gamestate:updated is notified, with a parameter containing further information about the state of the game.

quit a tournament

engine.quit(tournamentID);

When the tournament finishes the message tournament:completed is notified.

prepare your player

{
  id: 'my-player',
  name: 'My player',
  bet: function (gamestate, bet) {

    // gamestate contains info about the state of the game.
    // bet is the function you should use to send your bet.

    // currently we just fold every single hand
    return bet(0);
  }
}

poker-holdem-engine's People

Contributors

guscastro 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.