https://github.com/cleoold/linearly_varying_binomial_distribution_calcs
a "binomial" distribution with linearly increasing chance. Originally from a game Arknights, simulating the card pool system
https://github.com/cleoold/linearly_varying_binomial_distribution_calcs
game-arknights probability-distribution
Last synced: 8 months ago
JSON representation
a "binomial" distribution with linearly increasing chance. Originally from a game Arknights, simulating the card pool system
- Host: GitHub
- URL: https://github.com/cleoold/linearly_varying_binomial_distribution_calcs
- Owner: cleoold
- License: mit
- Created: 2019-07-25T19:06:15.000Z (almost 7 years ago)
- Default Branch: master
- Last Pushed: 2020-03-04T00:49:16.000Z (over 6 years ago)
- Last Synced: 2025-01-22T20:51:36.267Z (over 1 year ago)
- Topics: game-arknights, probability-distribution
- Language: C
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
[](https://cirrus-ci.com/github/cleoold/linearly_varying_binomial_distribution_calcs)
### .h
* create probability struct `struct LVBdistribution`
* do calculations
### function_tests
* used to check the correctness of this library
### consoleapp
* a sample calculator that uses this distribution to do calculations
### Description of the math
* Please open this readme file in a viewer that supports latex equations if you want to see them.
The cardpool of the game looks like:
One can flip a card. there is a probability (here say 0.02) to have a good one at the beginning.
* If one does not have the good one for some attempts in a row, the constant (here say 0.02) will be added to the existing probability (so that the chance of having the good one is increasing) until one finally has the good card, at which point the chance will reset to the original one.
For example, one tried 52 times and there have been no successes. At this point his/her chance to success for the next time will be 0.08. If the 53-rd try is a success, then the chance for the 54-th try will be reset to 0.02, otherwise the chance becomes 0.10. Also the maximum number of tries allowed here is calculated 99, where the chance is 1.
* the distribution:
```c
struct LVBdistribution create_model( probability base_prob_of_success, // = 0.02
probability additional_prob_of_success, // = 0.02
int threshold_to_activate_addition); // = 50
```
Note if `additional_prob_of_success` is 0 then it does not make sense as the distribution will fall back to binomial distribution (The current algorithm does not support this, please feel free to implement)
* The (conditional) probability of success at n given that one fails for n-1 times:
```c
probability have_success_given_no_successes_before(distr *s, int n);
```
$$
pf(n)=
\begin{cases}
0.02, & 0