I am trying to build an equity range calculator similar to that of Pokerstove, pro poker tools, flopzilla etc.
I have the single hand vs hand hand working pefectly but when I do hand vs range I have small discrepencies when i have more than one opponent with the same cards or same ranges.
I was looking at the following source:
https://github.com/mihhailnovik/jSimIn the area where there is monte carlo simulation I cannot figure what is different in my logic than from the code he provides so I;d like to explain what I'm doing and maybe someone can correct my approach.
1) I specify a players specific hand
2) specify the board.
3) I remove those cards from the remaining available cards.
4) Specify a few ranges for each opponent
5 ) For each iteration in the simulation i randomize who is dealt the first hand. For example Opponent 2 below might be dealt first and receive AdKc then the next iteration opponent 3 could be dealt first.
6) For each players range, i use rand on the number of ranges and then pull a specific hand based on that random value.
For example if a player can have 18 different hands between AA, KK, QQ i run a rand % 18 and the use the result as the hand from the array to assign.
I do that for each opponent and check to make sure the cards in the hand are available and not already taken such as:
if( (selectedHand & usedCards) ==0) {
opponentMask[n] = selectedHand;
}
When i run the code the results come back close but still like .25 or .45 different but other times they might be off be off by more depending on the order that I specified the ranges and how many opponents share similar ranges or hands with same cards.
It seems there is something not random enough in they way I am drawing hands. Can anyone suggest something I am fundamentally missing ? Thanks,
An example of something that would evaluate differently is
Player 9h9d
Opponent 1) AA,KK,QQ,TT,44
Opponent 2) 88,44,33,JTs
Opponent 3) KK,77,JJ,65s
will return about .3 to .4 different from
Player 9h9d
Opponent 1) 88,44,33,JTs
Opponent 2) KK,77,JJ,65s
Opponent 3) AA,KK,QQ,TT,44
board in both cases AsQc3d
Any insight or help is appreciated.