Nice work!
I'm most impressed by the plinko, that's really well done. It's really cool how it looks like a physics engine, but is totally predetermined too.
I found an old script I had, and verified the house edges. If anyone is interested in doing so, here's the js code:
let factorial = (() => {
const cache = [];
function f (n) {
if (n == 0 || n == 1)
return 1;
if (cache[n] > 0)
return cache[n];
return cache[n] = f(n-1) * n;
}
return f
})()
function c(n, k) { return factorial(n) / factorial(n - k) / factorial(k) }
function houseEdge(payouts) {
let t = 0;
let p = 0;
for (let i = 0; i < payouts.length; ++i) {
let comb = c(payouts.length-1, i);
t += comb;
p += payouts[i] * comb
}
return 1 - p/t
}
console.log('low', houseEdge([ 10, 3, 1.6, 1.4, 1.1, 1.0, 0.5, 1, 1.1, 1.4, 1.6, 3.0, 10 ]) * 100 , '%')
console.log('medium', houseEdge([ 33, 11, 4, 2, 1.1, 0.6, 0.3, 0.6, 1.1, 2.0, 4.0, 11, 33 ]) * 100 , '%')
console.log('high', houseEdge([ 170, 24, 8.1, 2.0, 0.7, 0.2, 0.2, 0.2, 0.7, 2.0, 8.1, 24, 170 ]) * 100 , '%')
and should get:
low 1.0205078125000044 %
medium 1.0107421875000022 %
high 0.8837890624999956 %