// Collection of code snippets by Arne Vajhøj 
// (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) 
public class Roulette {
    public static void main(String[] args) {
        double ploss = 0.50;
        double mloss = 1;
        for(int i = 1; i <= 25; i++) {
            double e = ploss * mloss - (1 - ploss) * 1;
            System.out.println("it: " + i +
                               ", p(vinder): " + (1 - ploss) +
                               ", p(taber): " + ploss +
                               ", e|vinder: " + 1 +
                               ", e|taber: " + mloss +
                               ", e: " + e);
            ploss /= 2;
            mloss += Math.pow(2, i);
        }
    }
}
