Live data from Hacker News

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

pokerapi.dev

21–30 of 45 posts

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

#21
post #15
post #6

Earlier quoted context omitted.

If you don't need everything that's going on in poker-eval, you should be able to roll your own two dozen lines of Python. A poker hand evaluator is problem #54 at Project Euler. [0] Peter Norvig has a solution there (which you can view after you submit your own correct solution) that taught me a lot about Python-style and how it differs from C++ (which was my mindset at the time). [0] https://projecteuler.net/proble…

That's very nice, much shorter than mine. array[[i][/i]r] had me scratching my head for a few minutes, when I realized those were stray italic tags. My only complaint is he doesn't check for the wheel, but to be fair most solutions don't seem to.

The wheel is excluded by the problem definition (or rather, not specifically included). The ace only counts as a high card here.

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

#22

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.

It's not apparent to me which part of evaluating poker hands would need to be updated over time... Just rebuilding for new framework versions?

Evaluating quality source code:

1. Does it have a badge that says "build passing"?

2. Does it have a bunch of stars on GitHub?

3. Does it have a commit in the past week?

If so, wrap that in an npm package and publish it.

Otherwise, it's AbAnDoNwArE.

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

#23
post #12

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

Basically you do that when you play poker. Knowing hand odds, pot sizes, number of players, are all numbers you use to do on the fly calculations and use to aid risk/reward assessment while on the table

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

#26
post #21
post #15

Earlier quoted context omitted.

That's very nice, much shorter than mine. array[[i][/i]r] had me scratching my head for a few minutes, when I realized those were stray italic tags. My only complaint is he doesn't check for the wheel, but to be fair most solutions don't seem to.

The wheel is excluded by the problem definition (or rather, not specifically included). The ace only counts as a high card here.

Fair enough. I think the problem statement does not have enough information by itself (especially concerning how rank is used to break ties for two pairs), and so it invites people to fill in the blanks using their knowledge of the game.

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

#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. You can get it with practice and it's an obvious step for being a good poker player.

There's a huge difference in quality of players in virtual gaming vs "B&M" (bricks and mortar, or playing face to face.) The world mourned the poker scene after Black Friday because the market for horrible players with money to blow disappeared. This left the hard core grinders with nobody to fish but each other. I suppose this would be much like potential competition in a world of WFH vs requiring your presence in one of the most expensive cities in the world.

There's still lots of horrible players in B&M games. You can do okay with just a gut feel for the calculations in these games. A lot of players like to gamble. It depends on the level of the game. As the blinds climb, the game gets harder.

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

#28
post #3

Calculating odds would be more interesting

I agree. Not sure how this helps improve poker play.

It doesn't. Nothing does. Good poker players should have no problem doing all this in their heads. The tooling which does help is hand analysis and replay. I haven't kept up, but there used to be tools while playing online poker which would track your play and the play of your opponents. Then I believe there were databases where you could upload that information so that you could study the play of regular opponents. Most helpful was looking at your own play though.

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

#29
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. That’s when I quit.

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

#30
post #21
post #15

Earlier quoted context omitted.

That's very nice, much shorter than mine. array[[i][/i]r] had me scratching my head for a few minutes, when I realized those were stray italic tags. My only complaint is he doesn't check for the wheel, but to be fair most solutions don't seem to.

The wheel is excluded by the problem definition (or rather, not specifically included). The ace only counts as a high card here.

> The wheel is excluded by the problem definition (or rather, not specifically included).

Excluded was correct, if only indirectly: a straight is defined as five cards of consecutive value and aces are explicitly the highest (and not also the lowest) values, so the wheel is not a valid straight by the definition given.

Post reply on HN