<story><title>Show HN: Allocate poker chips optimally with mixed-integer nonlinear programming</title><url>https://github.com/jstrieb/poker-chipper</url><text>Every time I play a casual cash poker game with friends, we spend the first several minutes struggling to figure out chip denominations. I built this to automate that process.&lt;p&gt;Try it out here (the submitted link goes to the GitHub repo): &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;jstrieb.github.io&amp;#x2F;poker-chipper&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;jstrieb.github.io&amp;#x2F;poker-chipper&amp;#x2F;&lt;/a&gt;&lt;p&gt;It turns out that picking chip denominations optimally—such that as many chips are distributed as possible, and such that the denominations are nice—is hard (in the computational complexity sense). Upon reflection, the problem seemed to be a perfect fit for constrained optimization.&lt;p&gt;I first got a CLI prototype working with Z3 (an SMT solver with optimization capabilities &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;Z3Prover&amp;#x2F;z3&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;Z3Prover&amp;#x2F;z3&lt;/a&gt;) in Python. Then, I cross-compiled SCIP (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.scipopt.org&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.scipopt.org&amp;#x2F;&lt;/a&gt;) to web assembly, and ported my code to use SCIP instead of Z3 so it could run in the browser.&lt;p&gt;The web interface is designed to be fast and easy to use on desktop and mobile.&lt;p&gt;I would love to answer questions and discuss design choices. I&amp;#x27;m also open to feedback and bug reports. Thanks for taking a look!</text></story><parent_chain><item><author>ShaggyPE</author><text>You&amp;#x27;ve solved the problem with an incorrect assumption.  You have assumed that the ideal situation is to use all of the chips in your collection.  A better solution is to ask, what is the most playable breakdown for the poker games I am playing.  If I am playing 25c&amp;#x2F;50c no limit hold&amp;#x27;em with 8 players... and a typical buy-in of $20 per player... as an experienced poker host at these limits, I maintain that the ideal breakdown is:
12x 25c
12x $1
1x $5&lt;p&gt;If you have a set with 100x of white, blue, red, green, etc... your total number of chips used for 8 players is:
96x white (25c)
96x blue ($1)
8x red ($5)&lt;p&gt;If players lose all of their chips... they can re-buy with $5 (red) chips and make change from the players that have all of the lower denomination chips.&lt;p&gt;What I have proposed above is a proper solution if you want to play poker.</text></item></parent_chain><comment><author>Raidion</author><text>Also an experienced poker player, and this is 100% correct.&lt;p&gt;Ideally you want to use common casino chip colors (though these are somewhat fungible) and just shift orders of magnitudes.&lt;p&gt;If 1BI is 20 bucks, you can make it equivalent to a $200 BI at the casino, which really only uses 2 colors 95% of the time: whites for 1 dollar, reds for $5. Deeper games might need a $25 (green) or even $100 (black chip). So whites in your home game are 10c, reds are 50c, greens are $2.50, blacks $10.</text></comment>
<story><title>Show HN: Allocate poker chips optimally with mixed-integer nonlinear programming</title><url>https://github.com/jstrieb/poker-chipper</url><text>Every time I play a casual cash poker game with friends, we spend the first several minutes struggling to figure out chip denominations. I built this to automate that process.&lt;p&gt;Try it out here (the submitted link goes to the GitHub repo): &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;jstrieb.github.io&amp;#x2F;poker-chipper&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;jstrieb.github.io&amp;#x2F;poker-chipper&amp;#x2F;&lt;/a&gt;&lt;p&gt;It turns out that picking chip denominations optimally—such that as many chips are distributed as possible, and such that the denominations are nice—is hard (in the computational complexity sense). Upon reflection, the problem seemed to be a perfect fit for constrained optimization.&lt;p&gt;I first got a CLI prototype working with Z3 (an SMT solver with optimization capabilities &lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;Z3Prover&amp;#x2F;z3&quot;&gt;https:&amp;#x2F;&amp;#x2F;github.com&amp;#x2F;Z3Prover&amp;#x2F;z3&lt;/a&gt;) in Python. Then, I cross-compiled SCIP (&lt;a href=&quot;https:&amp;#x2F;&amp;#x2F;www.scipopt.org&amp;#x2F;&quot; rel=&quot;nofollow&quot;&gt;https:&amp;#x2F;&amp;#x2F;www.scipopt.org&amp;#x2F;&lt;/a&gt;) to web assembly, and ported my code to use SCIP instead of Z3 so it could run in the browser.&lt;p&gt;The web interface is designed to be fast and easy to use on desktop and mobile.&lt;p&gt;I would love to answer questions and discuss design choices. I&amp;#x27;m also open to feedback and bug reports. Thanks for taking a look!</text></story><parent_chain><item><author>ShaggyPE</author><text>You&amp;#x27;ve solved the problem with an incorrect assumption.  You have assumed that the ideal situation is to use all of the chips in your collection.  A better solution is to ask, what is the most playable breakdown for the poker games I am playing.  If I am playing 25c&amp;#x2F;50c no limit hold&amp;#x27;em with 8 players... and a typical buy-in of $20 per player... as an experienced poker host at these limits, I maintain that the ideal breakdown is:
12x 25c
12x $1
1x $5&lt;p&gt;If you have a set with 100x of white, blue, red, green, etc... your total number of chips used for 8 players is:
96x white (25c)
96x blue ($1)
8x red ($5)&lt;p&gt;If players lose all of their chips... they can re-buy with $5 (red) chips and make change from the players that have all of the lower denomination chips.&lt;p&gt;What I have proposed above is a proper solution if you want to play poker.</text></item></parent_chain><comment><author>MaxfordAndSons</author><text>Yea the &amp;quot;optimal&amp;quot; solution shown by the default input is pretty silly. You&amp;#x27;re giving everyone 5 chips with which they can post blinds, and they&amp;#x27;re going to use 3 of them per turn through the blinds, so after 1 turn through the blinds someone who has won no hands will need to make change with someone else. And making change from the next smallest denomination will require 5 of that persons small chips!&lt;p&gt;Other, less important usability consideration is that you would typically want &amp;quot;round&amp;quot; amounts of chips, ideally stacks of 10 or 20, though having a few big chips in odd amounts is fine. Not as big a deal, but again, very much diverging from typical poker ux expectations.&lt;p&gt;Neat project technically, but highly impractical for actually playing poker.&lt;p&gt;edit: to be fair, just saw the advanced options, which would allow it to produce a more useful result, so that&amp;#x27;s cool. maybe just update the defaults :)</text></comment>