The first constraints are the required ones:
- The sum of (color value * color quantity) for all colors must equal the buy-in
- For each color, (color quantity * number of players) must be less than the total number of chips of that color
Theoretically any combination adhering to these constraints would be valid, but it wouldn't necessarily be "nice." The main idea behind the "niceness" constraints are to choose denominations that are easy to remember and easy to work with. To that end, there are a number of requirements and soft constraints that nudge the optimizer towards better denominations if it can. For example, a few are: - One chip value should be the small blind, and try to minimize the number of chips required to make the big blind
- Chip values should try to be multiples of a set number ($0.25 by default, tunable in the UI)
- Chips above $1 should be multiples of $1
- Chip values should try and be multiples of smaller chip values so that change can be made in as many ways as possible
- Distribute as many chips as possible so that people have big stacks to play with
The code for all of the constraints is here, and is commented in English for readability:https://github.com/jstrieb/poker-chipper/blob/fab41bbe8821d0...