Bayesian Coin Flip Game

This interactive game demonstrates Bayesian inference in action. You and an AI opponent try to guess the bias of a hidden coin by observing the results of coin flips. The AI updates its belief using Bayesian inference, while you can adjust your belief manually. Your score is penalized by the log-loss function, which rewards accurate probability estimates.

Round: 0/20
Heads: 0
Tails: 0
Player
Balance: $100.00
Heads Penalty: $1.00
Tails Penalty: $1.00
25¢
Opponent
Balance: $100.00
Heads Penalty: $?
Tails Penalty: $?

The penalties are calculated using the "log loss" (negative log likelihood): -log₂(p) for heads and -log₂(1-p) for tails, where p is your estimated probability of heads. This scoring rule encourages honest probability reporting.

The opponent uses Bayesian updating with a Beta distribution as its prior, which is the conjugate prior for the Bernoulli distribution.