Live data from Hacker News

Show HN: A simple Poker API to calculate the winning hand/s

pokerapi.dev

31–40 of 45 posts

Re: Show HN: A simple Poker API to calculate the winning hand/s

#31

What are you using under the hood? I’ve been using poker-eval for a few projects but it seems its now abandonware, with few updates out there. I’m tempted to port it to Go and/or Rust to keep it alive, but I’m interested in what else people are using out there for poker hand evaluation.

Here's an implementation in Clojure that scores hands and selects a winner. It handles low vs high ace in straights.

https://gist.github.com/mchampine/dca965226148dfd19d5e4d7f3d...

Most of it was done for a weekly Clojure programming challenge run by Eric Normand in his PurelyFunctional.tv newsletter. You can see all the entries at https://gist.github.com/ericnormand/fbc9b6386a66c1ece590930d...

Re: Show HN: A simple Poker API to calculate the winning hand/s

#32

I once had to write a version that worked for multiple games. Holdem, Omaha, Omaha 8 or better, Ace to Five, Deuce to Seven, and Badugi. I did it using inheritance, having high and low hand classes. The low ball games just reverse ordinary logic, but Omaha 8 needed both and the 8 or better restrictions. The Badugi class rewrote everything entirely. When I finally finished I was asked to add Stud, Badeucy and Badacey.…

Would you do this in a different way now?

Re: Show HN: A simple Poker API to calculate the winning hand/s

#33

I once had to write a version that worked for multiple games. Holdem, Omaha, Omaha 8 or better, Ace to Five, Deuce to Seven, and Badugi. I did it using inheritance, having high and low hand classes. The low ball games just reverse ordinary logic, but Omaha 8 needed both and the 8 or better restrictions. The Badugi class rewrote everything entirely. When I finally finished I was asked to add Stud, Badeucy and Badacey.…

Would you do this in a different way now?

I wouldn’t do it in Objective C again, that’s for sure.

But no, I think the class structure worked well for this. Just too many esoteric rules in these games. And it’s getting worse from what I hear of the high stakes games. Archey was just getting popular when I quit and now there is like a half dozen new games they play. It’s a constant arms race to see who can master a new set of rules to skin the fish with.

Re: Show HN: A simple Poker API to calculate the winning hand/s

#34
post #27
post #12

I have a sudden urge to extend this to calculating probabilities and to buy a pair of smart glasses.

This has been a standard tool in remote poker for years. That tooling has even included hand histories for your opponent. One of the last great new players to blow up the poker scene before "Black Friday" almost went bust in a match where his opponent analyzed his hand history. You wouldn't gain an edge with these tools, you would be way behind if you didn't use them. Running the calculations in your head isn't hard.…

For anyone wondering, Black Friday seems to refer to this: https://en.wikipedia.org/wiki/United_States_v._Scheinberg

Re: Show HN: A simple Poker API to calculate the winning hand/s

#35

Earlier quoted context omitted.

Would you do this in a different way now?

I wouldn’t do it in Objective C again, that’s for sure. But no, I think the class structure worked well for this. Just too many esoteric rules in these games. And it’s getting worse from what I hear of the high stakes games. Archey was just getting popular when I quit and now there is like a half dozen new games they play. It’s a constant arms race to see who can master a new set of rules to skin the fish with.

As crazy as it sounds, this is why I'd try to keep it simple and just keep each implementation separate. Sure I'd save some keystrokes having a base abstraction and whatnot, but I feel like Poker is one of those "i'll make an interface" traps that is much more complex than it originally seems

Re: Show HN: A simple Poker API to calculate the winning hand/s

#36
post #27
post #12

I have a sudden urge to extend this to calculating probabilities and to buy a pair of smart glasses.

This has been a standard tool in remote poker for years. That tooling has even included hand histories for your opponent. One of the last great new players to blow up the poker scene before "Black Friday" almost went bust in a match where his opponent analyzed his hand history. You wouldn't gain an edge with these tools, you would be way behind if you didn't use them. Running the calculations in your head isn't hard.…

I played online during the golden years (2003-2010), made a lot of money but also witnessed the progression of the game from shooting fish in a barrel to becoming significantly more demanding, even at low stakes.

I started playing one table at a time, then two and ended up at 4 (6max NL holdem). One thing that always bothered me, especially when the HUDs + pokertracker became necessities, was that no poker site allowed you to switch usernames in order to nullify playing history that your opponents had accumulated.

Eventually, this ruined the game for me as it completely changed the dynamics and took away a lot of possibilities and excitement. I also saw limit holdem be completely destroyed by algorithms and bots, long before it became so obvious that most stopped playing it altogether. I don't play these days but I'm wondering as to what extent shorthanded NL is being algorithmically exploited.

Re: Show HN: A simple Poker API to calculate the winning hand/s

#37
post #16

Earlier quoted context omitted.

Is it not? The win criteria is well specified so just iterate downwards from the highest priority win until you find a match?

Sure, but that gets complicated when comparing two matching hands (flush vs flush, 2 pair vs 2pair). It’s more than a 50 line problem to solve.

Okay fair it’s more than 50 lines, I guess my definition of non-trivial is something you can’t quickly think of a design for. I’ll try it later and see if there’s some gotchas I can’t think of :)

Re: Show HN: A simple Poker API to calculate the winning hand/s

#38

What are you using under the hood? I’ve been using poker-eval for a few projects but it seems its now abandonware, with few updates out there. I’m tempted to port it to Go and/or Rust to keep it alive, but I’m interested in what else people are using out there for poker hand evaluation.

https://github.com/andrewprock/pokerstove

Re: Show HN: A simple Poker API to calculate the winning hand/s

#39
One of my side projects was to make a game where you need to calculate your odds correctly as fast as possible but main goal was to learn some TypeScript so I lost interest after I was satisfied.

Anyway, I got at least one "game" done, you need to correctly count your outs. It is not perfect but covers most cases well.

https://github.com/GustekDev/poker-odds-game

Re: Show HN: A simple Poker API to calculate the winning hand/s

#40
Reminds me of the 2+2 poker hand evaluator - they basically built an insanely fast giant lookup table that fit in ~100megs of ram IIRC.

The main idea was to do monte-carlo simulations and give you your odds of winning at any point in the game by dealing random cards for the unknowns.

Interesting read on that and other evaluators as well:

http://web.archive.org/web/20130116102452/http://www.codingt...

Post reply on HN