xxxxxxxxxx
22
let n=0
let N=100000
function setup() {
createCanvas(400, 400);
for(let i=0;i<N;i++){
die(0)
}
print(n/N)
}
function draw() {
background(220);
}
function die(x){
let ran=(x+random([1,2,3,4]))%6
n++
if(ran==1){
die(3)
} else if(ran==4){
die(2)
} else if (ran<5){die(ran)}
}