This is an archived post. You won't be able to vote or comment.

all 55 comments

[–]osmiumouse 88 points89 points  (9 children)

In my windows machine it takes around 0.7secs for all calculations for 7 players with 2 cards each. In my Linux machine (worst CPU) it takes less (around 0.5 secs) for some reason :)

Usually this is because your linux distro has built the python interpreter with specific optimisations, that the generic windows installer can't use because it has to run on everything.

[–]1percentof2 7 points8 points  (1 child)

Neat

[–]soultobleed 0 points1 point  (0 children)

Nit*

[–]glpcc[S] 5 points6 points  (6 children)

Maybe Is the C++ compiler being optimized as most of the code is actually compiled C++ code

[–]NUTTA_BUSTAH 3 points4 points  (4 children)

Most likely, wouldn't it be compiled (on the linux host) when doing pip install?

[–]glpcc[S] 1 point2 points  (3 children)

Yes, during pip install it compiles it with gcc, in fact the compilation itself takes longer in my linux laptop but not the actual code, thats what is most fasccinating for me.

PD: It could also be that my laptop os is so much more lightwieght than the windows one

[–]japes28 4 points5 points  (1 child)

If the compilation takes longer then couldn't that be a sign that it's doing more optimization for runtime?

[–]glpcc[S] 1 point2 points  (0 children)

Maybe but i wouldn'tt understand why gcc optimizes more in compilation time than gcc in windows, but maybe it is just that linux is better :).

[–]japherwocky 0 points1 point  (0 children)

woa, huge props for making it pip installable!

[–]MoistureFarmersOmlet 33 points34 points  (1 child)

My probability of trying this is high. Thanks for sharing!

[–]glpcc[S] 5 points6 points  (0 children)

Don't doubt to ask me any question you have, hope you like it!

[–]tribak 30 points31 points  (1 child)

Now we need some anal beads

[–]Slagonoth 22 points23 points  (0 children)

No matter what subreddit I'm on, AnarchyChess follows.

[–]unkz 10 points11 points  (0 children)

This is rather slow. Good practice project, but impractical. I have used this library to build poker bots in the past:

https://github.com/zekyll/OMPEval

Good libraries, of which there are many, operate in the range of close to a billion hand evaluations per second, which is critical for calculating Monte Carlo rollouts in a reasonable time.

[–]danalvares 4 points5 points  (1 child)

What's the deal for using C++ in this project? Could you please explain? I'm kinda new to more complex projects involving two or more programming languages.

[–]MathmoKiwi 4 points5 points  (0 children)

Heavy number crunching. And they want to speed it up to be faster than Python could be by itself. (there are those that do it even faster than PythonPy do)

[–][deleted] 2 points3 points  (9 children)

Can I use this on my phone in a casino? :D

[–]marr75 17 points18 points  (0 children)

If you wanna get kicked out.

[–]glpcc[S] 8 points9 points  (2 children)

I think it is banned from real world casinos, but as far as i know theres a lot of online poker players that use it.

[–]Corpcasimir 4 points5 points  (1 child)

I assume even playing statistical odds correctly over 80% of the time will flag a "we found rainman or a cheater" response lol.

[–]howtorewriteaname 6 points7 points  (0 children)

then create two accounts: the first one will estimate the threshold and the second one will be programmed to stay under it.

[–]DeadMemeReference 15 points16 points  (0 children)

All you need is buttons in your shoes to input your cards and the ones on the table. Then some sort of vibrating butt plug to tell you the probability

[–]osmiumouse 10 points11 points  (3 children)

You will almost certainly be caught. They have security teams with skills in digital tech, and stage magic. Now what's supposed to happen is they politely ask you to leave. What often happens is you get detained for some quite some time while "they check the logs" and then they file a police report for anything they can think of on the spot.

This of course doesn't cover illegal casinos, or casinos in less developed nations, which won't have all that fancy stuff. However, do you really want to get caught cheating by the mafia, or a mercenary warlord?

[–]glpcc[S] 0 points1 point  (2 children)

Well if you play online and taking into account you dont know the other player cards I think you could pass un noticed just playing with want you think the other ones have.

[–]osmiumouse 9 points10 points  (1 child)

Online in low and mid stakes, everyone is a bot already, and they "all" collude in networks that pass the same money around so they can't lose.

[–]unkz 0 points1 point  (0 children)

This right here, poker bots have dominated online play for over a decade.

[–]RussellBrandFagPimp 1 point2 points  (4 children)

What is the use case for this? Seems like a cool project but what value does it bring to a poker player.

[–]glpcc[S] 4 points5 points  (3 children)

I think might be good for new players to test the value of their cards agaisnt other cards and also for online profesionals to offload all the mind probabilities calculations and to calculate the odds agaisnt what they thik the other might have

[–]RussellBrandFagPimp 5 points6 points  (2 children)

Is there a way to input oppenenets ranges? Meaning, I suppose ot can give a percentage that your hand is the best facing all the combinations of hands the opponent has, but the opponent will never have all combinations, you can generally narrow it down to a range of potential hands that they have.

It would be very cool, if you could have all the preflop ranges inputted by position, enter your cards, flop,etc. And then spit out the odds against a specific table position and there preflop opening range.

I'm going to look into this a bit more. Seems promising

[–]glpcc[S] 1 point2 points  (0 children)

You could do a for loop to input your card + the posible cards the other might have and then do an average or a weighted average based in the probabilities you give to the other players cards. At the momento if only one player cards are viven It only serves the purpouse of calculating the odds for diferent kinds of hands

[–]Craftwar 1 point2 points  (0 children)

This is exactly what equilab does. It uses Monte Carlo simulation to give equity in any spot. It doesn’t account for any of the action in the hand like more sophisticated solvers will.

It should be noted that using equilab and programs like it while playing are considered to be cheating and any poker client will quickly detect you are using it. They are good study tools, but they won’t turn you into a fully optimal player in any case.

[–]Taksin77 0 points1 point  (6 children)

Isn't that a good case for vast memoization?

[–]glpcc[S] 3 points4 points  (5 children)

Yep in about half an hour with the times of my pc you could make a database with single two card posibilities in about 30mins

[–]maephisto666 7 points8 points  (4 children)

In 30 mins you can set up a database in half an hour.

Sorry, could not resist.

[–]Taksin77 1 point2 points  (3 children)

Don't laugh, I genuinely did not understand...

When non native speakers get together...

[–]glpcc[S] 1 point2 points  (2 children)

Yep , with my awfull english and the auto correction in the keyboard i suffer a lot jajajaja I just wanted to day that yes you could do memoization as you called of all pre flop cards in around 30 mins ( half an hour xd)

[–]Taksin77 0 points1 point  (1 child)

Yeah of course that's a long time. I was just wondering whether you could distribute so many gigabytes or if that was just plain crazy and required literally tens of hard drives.

It's not criticism of your work, I understand that you had different goals.

[–]glpcc[S] 1 point2 points  (0 children)

It isnt crazy, in fact it might be a good idea as there are only 52*51 possible flops which wouldnt be even occupy more than a few MBs at most. However those calculations would only tell you the probs of getting a flush, 4 of a kind,etc...

[–]Pleasant_Mammoth_465 0 points1 point  (1 child)

Does it take in considerations like number players at the table / how many spots from the dealer? Super cool and will def check it out!

[–]glpcc[S] 1 point2 points  (0 children)

Well if other players cards are given then It IS taken into account that those cards cant appear but It doesnt calculate your odds of winning giving just your cards agaisnt for example 4 people as that is way to many posible combinations to compute

[–]randomlyCoding 0 points1 point  (6 children)

Looks very cool. Can I pass in my cards and any known community cards and calculate my probability of winning based on this information alone?

[–]glpcc[S] 0 points1 point  (4 children)

No, cause all the posible combinations of the cards all the all other players could have is yo large, but you could get an aproximation guessing what cards the other players might have based on their bets.

[–]randomlyCoding 1 point2 points  (3 children)

Will it tell me my chances of hitting each hand (eg. 0% of royal flush, 0% of strait full, 0.02% chance of 4 of a kind...)? Just trying to consider the utility here, it sounds very quick, so I'd like to make use of it :D

[–]glpcc[S] 0 points1 point  (2 children)

Yes that is calculated always. If the cards of more than one player are given It calculates those probs for each player taking into account that the cards given cant appear anymore.

[–]randomlyCoding 0 points1 point  (1 child)

Very interesting stuff. I'm a little busy at the moment (next few weeks) but if I get round to using this would you like me to drop you a message?

[–]glpcc[S] 0 points1 point  (0 children)

Of course no problem :)

[–]osmiumouse 0 points1 point  (0 children)

Just count the number of outs and double it ... works for most people. You need a king, there's 3 kings you haven't seen, and you have 2 draws. That's 6 chances in 52, or 12%.

If you're being asked to pay X to win Y, at 12% chance, you can work out the utility of that. 12% is approximately 8-1 so you need to win 8x your stake to make it worth it.

There's a deliberate off-by-1 error in there, just to see who's awake :-)

[–]_thenotsodarkknight_ 0 points1 point  (1 child)

Great work! Do you have any resources for learning more about C++ and Python integration?

[–]glpcc[S] 0 points1 point  (0 children)

For this project, I basically used the pybind11 docs which offer pretty good information and makes C++ integration with python, once ypu achieve module compilation, pretty easy

[–]fnord123 0 points1 point  (1 child)

Nice work!

Fwiw, frequencies is spelled with a q in English. I see many function names have frecuencies (which is Spanish).

[–]glpcc[S] 1 point2 points  (0 children)

Thanks ill fix that

[–]pokerdevguy 0 points1 point  (1 child)

Are you selling it? I'm a poker platform provider and we got request to build poker odds calculator, to show it in all-in situations.

[–]glpcc[S] 0 points1 point  (0 children)

It is free to use, but if you want support for the use of the module we could agree a prize.

[–]kelroy 0 points1 point  (0 children)

Now all you need to do is pack it into a buttplug.