https://github.com/jstrieb/poker-chipper Skip to content Navigation Menu Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + GitHub Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Enterprise + Enterprise platform AI-powered developer platform Available add-ons + Advanced Security Enterprise-grade security features + GitHub Copilot Enterprise-grade AI features + Premium Support Enterprise-grade 24/7 support * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} jstrieb / poker-chipper Public * Notifications You must be signed in to change notification settings * Fork 1 * Star 87 * Optimally allocate poker chips using constrained, nonlinear optimization jstrieb.github.io/poker-chipper/ 87 stars 1 fork Branches Tags Activity Star Notifications You must be signed in to change notification settings * Code * Issues 0 * Pull requests 0 * Actions * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Security * Insights jstrieb/poker-chipper This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. master BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 154 Commits .github/workflows .github/workflows experiments experiments public public src src .gitattributes .gitattributes .gitignore .gitignore .prettierignore .prettierignore .prettierrc .prettierrc Makefile Makefile README.md README.md index.html index.html package-lock.json package-lock.json package.json package.json vite.config.js vite.config.js View all files Repository files navigation * README [favicon] Poker Chipper Optimally select poker chip denominations for cash games using constrained, nonlinear optimization. About Imagine hosting a small poker game. You know how many friends will attend, how many chips you have, and the buy in. How do you pick chip denominations? Without Poker Chipper, picking chip denominations is manual and error-prone. You first try to pick values that divide each other nicely and are easy to remember. (Alternatively, struggle to recall the values from the last time you played.) You next try to find a way to make the chosen values sum to the buy in. Then, you backtrack whenever there aren't enough chips for everyone, or when there are too many chips left over. Finally, you settle for a suboptimal chip allocation so that you can actually start playing. With Poker Chipper, on the other hand, picking chip denominations is fast and easy. Input the number of players, buy in, blinds, and number of chips. After waiting a moment for the mathematically optimal results, you can save them for next time, or share them with others. If you want to modify the results, adjust the "advanced options," and the chip denominations will be recomputed accordingly. How Poker Chipper Works Poker Chipper uses mixed-integer nonlinear programming (MINLP), which is a form of constrained, nonconvex optimization, to optimally pick poker chip denominations. Optimization is performed using a "solver" - in this case, SCIP. Some inputs to Poker Chipper are translated into solver constraints, which affect what denominations are admissible. Other inputs influence the solver's objective function, which affects how candidate denominations are evaluated, ranked, and chosen. In the user interface, inputs affecting constraints, and inputs affecting the objective function are described as influencing the "requirements" and "score," respectively, of candidate solutions. Poker Chipper is a fully static web application. In other words, all of the processing involved in performing optimization occurs client-side - entirely in the user's browser. The SCIP solver is designed to run natively, so Poker Chipper bundles it for the browser by compiling SCIP to WebAssembly (WASM) with Emscripten. How to Read the Code Code Table of Contents The links below are listed in the order the code should be read to understand the application from the highest to lowest level. * src/App.svelte - main high-level application * src/*.svelte - UI components * src/solve.js - convert user inputs to MINLP model and solve using WASM SCIP * src/solveWorker.js - web worker to run solver in non-blocking thread * public/serviceWorker.js - service worker for caching and offline functionality * public/* - PWA manifest, global stylesheet, favicons, etc. * experiments/* - exploration of initial concept in Python (with both Z3, and later, SCIP), and Dockerfile for compiling SCIP with Emscripten * src/compiled/* - SCIP compiled to WASM via Emscripten, plus associated support files Application Architecture In the diagram below, labeled arrows represent asynchronous fetch requests and message passing. flowchart LR A[Svelte Front End] -->|Solve Requests| B["Web Worker (non-blocking thread)"] B -->|Solutions| A A <-->|Static Assets| C[Service Worker] B <-->|Solver Static Assets| C C -->|Cache| C C <-->|Static Assets| D[Web Server] Project Status & Contributing Poker Chipper is actively maintained. If there are no recent commits, everything is running smoothly! As of the initial release, the code is stable, and there are no major, outstanding features that remain to be added. Bug reports and feature requests via GitHub Issues are encouraged. Pull requests with more than 20 lines of code are unlikely to be merged quickly, unless associated with prior discussion or accompanied by substantial, explanatory English prose. In other words, pull requests containing code without context may be merged after much delay, or may not be merged at all. Since Poker Chipper is a fully static web application with no server-side processing (outside of serving unchanging files), it is extremely scalable, and has a very low maintenance burden. As such, even if something were to happen to me, and I could not continue to work on the project, the public version should continue to remain functional and available online as long as my GitHub account is open and the jstrieb.github.io domain is active. Support the Project The best ways to support the project are to: * Share the project on sites like Twitter, Reddit, and Hacker News * Report any bugs, glitches, errors, or shortcomings that you find * Star the repository and follow me on GitHub * Host a version of the code translated into another language If you insist on spending money to show your support, please do so in a way that is widely beneficial. In particular, donations to the following organizations help me, in addition to the general, Internet-using public: * Electronic Frontier Foundation * The Internet Archive * Signal Foundation * Mozilla Acknowledgments & Greetz Poker Chipper would not have been possible without help and feedback from: * Logan Snow * Amy Liu * Chris Cherian * Ani Chowdhury * Will Hooper About Optimally allocate poker chips using constrained, nonlinear optimization jstrieb.github.io/poker-chipper/ Topics poker optimization svelte web-assembly constraint-satisfaction-problem web-application constraint-programming scip Resources Readme Activity Stars 87 stars Watchers 2 watching Forks 1 fork Report repository Languages * Svelte 46.6% * JavaScript 21.3% * HTML 16.3% * Python 10.5% * Dockerfile 2.7% * CSS 1.6% * Makefile 1.0% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.