def test_update_priors(): bd = BayesDice() bd.die = 8 bd.update_priors(4) assert bd.data[4] == approx(0.37, abs=1e-1) assert bd.data[8] == approx(0.18, abs=1e-1) assert bd.data[20] == approx(0.07, abs=1e-1) bd.update_priors(7) assert bd.data[4] == approx(0.00, abs=1e-1) assert bd.data[8] == approx(0.62, abs=1e-1) assert bd.data[20] == approx(0.10, abs=1e-1)
from src.bayesdice import BayesDice bd = BayesDice() bd.choose_die() for i in range(3): roll = bd.roll_die() bd.update_priors(roll)