passpigs

simple pass the pigs strategy
git clone https://a3nm.net/git/passpigs/
Log | Files | Refs

commit da4a0b64cc8e1386dce435574c9fcaa4bdc9b4e4
parent b32aba2da26ab4be75d157fb6869035360349aaf
Author: Antoine Amarilli <a3nm@a3nm.net>
Date:   Sun, 25 Dec 2016 23:46:13 +0100

small fix

Diffstat:
main.c | 6+++++-
1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/main.c b/main.c @@ -52,7 +52,11 @@ float play(int i, int j, int k) { // probability when stopping now // approximated: should be k 0 i+j - float pwin1 = 1 - play(k, 0, i+(j ? j : 1)); + float pwin1; + if (j > 0) + pwin1 = 1 - play(k, 0, i+j); + else + pwin1 = 0; // never stop on first round int tp = 0; float pwin2 = 0;