News for hackers. Stuff that matters.

Ask HN: Gin Rummy Strategies

Hi HN, I am having AI build me a local Gin Rummy trainer and it cannot figure out medium and hard bot strategies, they keep losing to easy! The point of this is to help me learn so I don't really know how to advise it on strategies. Right now it's just looping through tests and modifying but it keeps not improving. Does anyone have any recommendations or guidance for strategies I could suggest to it?
( 3 comments | 2 points | on HN )
Re:Ask HN: Gin Rummy Strategies by pschw on Thursday June 04, 2026 @06:29PM (#48405521)
See if you can find a copy of Michael Sall's book, it's pricey but it's the definitive guide to the game
Re:Ask HN: Gin Rummy Strategies by aidenn0 on Thursday June 04, 2026 @07:42PM (#48406177)
A bot that will minimize the expected number of (not yet seen) cards to draw to complete the hand the hand does reasonably well at deciding which card to draw or discard. The number of potential melds in a hand is small enough for modern hardware to completely enumerate, and you start the game with only 42 possible cards in the draw pile, with the number going down almost every turn, so the calculation is very feasible.

For knocking, a heuristic for how many turns vs. amount of deadwood (which should vary based on the undercut bonus you use) does "okay"; adding a bit of randomness should be done to prevent stronger players from being able to place a lower-bounds on your count may be a good idea.

Re:Ask HN: Gin Rummy Strategies by sillysaurusx on Friday June 05, 2026 @01:45AM (#48408438)
You could apply the AlphaZero algorithm. There are various GitHub repos designed to play games. One of them was connect four, and the model quickly surpassed my skill.

On the other hand that might not work for poker or other information hiding games. (Chess, checkers, and connect four have no hidden info.) I seem to remember an algorithm that can handle this case, but I forgot the name. You’d have to research it.