Displaying Chip value contribution #6 #20
No reviewers
Labels
No Label
Large
Medium
Small
bug
documentation
duplicate
enhancement
good first issue
help wanted
invalid
question
wontfix
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: david/poker-chips-helper#20
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "vutukuri15/6"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR is still a work in progress.
This PR introduces the ChipDistributionSummary component, which calculates and displays the distribution of poker chips based on the total buy-in amount, number of players, and available chip counts. The component handles the distribution of chips in descending order of chip values (from higher denomination to lower), ensuring that the total value per player matches the buy-in amount.
I gave this some thought to try to help with your algorithm. I don't have a solution to present but I can point out a few things with the code that might represent a misunderstanding or otherwise might be roadblock to a working algorithm.
const chipValues = [0.05, 0.25, 1, 2.5, 5]; // Chip values: white, red, green, blue, black
[.05, .10, .25, 1, 2.5]
as the chip values, and for the $100 game you might want something like[1, 5, 10, 25, 50]
. Also we cannot assume 5 unique color chips, that is just the maximum.const validDenominations = [0.05, 0.10, 0.25, 0.50, 1, 2, 5, 10, 20, 50, 100];
. Your algorithm can then logically pick 5 (or fewer) of these elements as the chip values. They way you pick the values may be tricky. But as a bound the most value chip should be worth no more than half the buy-in. You can add other bounds as they make sense, and add bounds to the buy-in feature as well to help constrain the complexity.let distribution = [0, 0, 0, 0, 0];
The rest of your algorithm shows thoughtfulness, but depends on the
chipValues
defined. Since that needs to be done differently, it's likely to effect the rest of the algorithm with some significance.As a last thought, I worded this question as best I could to ChatGPT. The algorithm outline it suggested describes a greedy approach which looks promising. I think that is closer to what will work for us, but cannot say if it is fully technically correct or not. I wouldn't pay too much attention to the code since the variable names and data-structures may be different.
notes to ease complexity. These are optional:
Closing for new PR to change authorship
Pull request closed