Poker equity calculator. Compares two combos or one combo against a range to compute winning equity.
const { raceRange, rates } = require('pec')
const combo = [ 'Jh', 'Js' ]
const range = [
[ 'Kh', 'Ks' ], [ 'Kh', 'Kd' ], [ 'Kh', 'Kc' ],
[ 'Ks', 'Kd' ], [ 'Ks', 'Kc' ], [ 'Kd', 'Kc' ],
[ 'Qh', 'Qs' ], [ 'Qh', 'Qd' ], [ 'Qh', 'Qc' ],
[ 'Qs', 'Qd' ], [ 'Qs', 'Qc' ], [ 'Qd', 'Qc' ]
]
const { win, loose, tie } = raceRange(combo, range, 1E4)
const { winRate, looseRate, tieRate } = rates({ win, loose, tie })
console.log('JJ performs as follows vs. [ KK, QQ ]')
console.log('win: %d%% (%d times)', winRate, win)
console.log('loose: %d%% (%d times)', looseRate, loose)
console.log('tie: %d%% (%d times)', tieRate, tie)JJ performs as follows vs. [ KK, QQ ]
win: 18.13% (21750 times)
loose: 81.43% (97718 times)
tie: 0.44% (532 times)
For more examples see the tests and the webworker example.
You can launch the web worker via npm install && npm run demo.
npm install pec
Parameters
comboArray<string> to race i.e.[ 'As', 'Ad' ]totalNumber the total number of times to race,100are processed each time andupdateinvoked until thetotalis reachedtrackCombosBoolean? iftruethe counts for each combos are tracked (optional, defaultfalse)boardArray<string>? if supplied the range will be raced against subsets boards that include all cards of the given board (optional, defaultnull)
Returns Number the uid generated to identify this background job, the same uid will be included in the message the result to identify it with the job
Stops any races in progress.
Creates a background worker which uses a web worker under the hood to process race requests.
Parameters
updatefuncion will be called with updates:{ win, loose, tie, iterations, uid }
Returns BackgroundWorker backgroundWorker
Same as @see raceCombosForBoard, except that the combo cards are given
as their codes obtained via phe cardCodes.
Parameters
combo1combo2timesboard
Same as @see raceCombos, except that the combo cards are given
as their codes obtained via phe cardCodes.
Parameters
combo1combo2times
Same as @see raceRangeForBoard, except that the combo, range cards and board are given
as their codes obtained via phe cardCodes.
Parameters
comboCodesrangeCodestimestrackCombosboardCodes
Same as @see raceRange, except that the combo and range cards are given
as their codes obtained via phe cardCodes.
Parameters
combo1rangetimestrackCombos
Races two combos against each other.
Parameters
combo1Array<string> first combo to race i.e.[ 'As', 'Ad' ]combo2Array<string> second combo to race i.e.[ 'As', 'Ad' ]timesNumber? the number of times to race, if not supplied combos are races against all possible boards (optional, defaultnull)boardArray<string>? omit for preflop, but provide for postflop to race against boards that just add a turn or river card to the given one (optional, defaultnull)
Returns any count of how many times combo1 wins, looses or ties, i.e. { win, loose, tie }
Races two combos against each other.
Parameters
combo1Array<string> first combo to race i.e.[ 'As', 'Ad' ]combo2Array<string> second combo to race i.e.[ 'As', 'Ad' ]timesNumber? the number of times to race, if not supplied combos are races against all possible boards (optional, defaultnull)
Returns any count of how many times combo1 wins, looses or ties, i.e. { win, loose, tie }
Race the given combo vs. the given combo to count number of wins, losses and ties. The boards created for the race will include all cards of the given board.
Parameters
comboArray<string> to race i.e.[ 'As', 'Ad' ]rangeArray<Array<string>> multiple combos to raise against it, i.e.[ [ 'Ks', 'Kd' ], [ 'Qs', 'Qd' ] ]timesNumber? the number of times to race, if not supplied combos are races against all possible boards (optional, defaultnull)trackCombosBoolean? iftruethe counts for each combos are tracked (optional, defaultfalse)boardArray<string>? omit for preflop, but provide for postflop to race against boards that just add a turn or river card to the given one (optional, defaultnull)
Returns any count of how many times the combo wins, looses or ties, i.e. { win, loose, tie }
Race the given combo vs. the given combo to count number of wins, losses and ties.
Parameters
comboArray<string> to race i.e.[ 'As', 'Ad' ]rangeArray<Array<string>> multiple combos to raise against it, i.e.[ [ 'Ks', 'Kd' ], [ 'Qs', 'Qd' ] ]timesNumber? the number of times to race, if not supplied combos are races against all possible boards (optional, defaultnull)trackCombosBoolean? iftruethe counts for each combos are tracked (optional, defaultfalse)
Returns any count of how many times the combo wins, looses or ties, i.e. { win, loose, tie }
Given win, loose and tie count it converts those to winning rates in percent.
Parameters
$0Object
Returns Object win rates `{ winRate, looseRate, tieRate, combos? }
MIT