A library to simulate poker games (holdem)
Node library that simulates a poker game and calculates winning percentages
npm install poker-sim
moment (not really needed, could be removed in future)
var pokerSim = require"poker-sim";var game = ;//add "Hands" or playersgameaddHand"Peter"addHand"Darren"addHand"Jim"addHand"Frank";//Deal two cards (getting fancy with this and trying to add more or less than 2 will probably get you in trouble)gamedealCarddealCard;//call evalHands() to process win percentages using the current state of the gamegameevalHands//output the status of the game to the consolegameprintGame;//flop (3 cards)gamecommunityCardcommunityCardcommunityCard;//eval and printgameevalHandsprintGame;//turngamecommunityCard;//eval and printgameevalHandsprintGame;//rivergamecommunityCard;//eval and printgameevalHandsprintGame;//at any time you can return the JSON of the game statusconsole.loggamegetGame;
poker-sim.getGame (useful to send to the client) poker-sim.getSave (useful to save the game state, returns the options you need to feed into constructor to resume)
Fairly untested, use at own risk or modify and make it better!