standalone rng for all grids

This commit is contained in:
Bruno Rybársky 2022-01-16 19:53:05 +01:00
parent 6fca8014bf
commit 0f84743019

@ -72,12 +72,16 @@ function randomizetable(){
for (let j = 0; j < h; j++) { for (let j = 0; j < h; j++) {
let r = Math.floor(Math.random() * 2); let r = Math.floor(Math.random() * 2);
if (r == 0) { if (r == 0) {
lgrid[i][j] = x;
rgrid[i][j] = o; rgrid[i][j] = o;
} else { } else {
lgrid[i][j] = o;
rgrid[i][j] = x; rgrid[i][j] = x;
} }
r = Math.floor(Math.random() * 2);
if (r == 0) {
lgrid[i][j] = o;
} else {
lgrid[i][j] = x;
}
} }
} }
} }
@ -87,12 +91,16 @@ function randomizeaux(){
for (let j = 0; j < haux; j++) { for (let j = 0; j < haux; j++) {
let r = Math.floor(Math.random() * 2); let r = Math.floor(Math.random() * 2);
if (r == 0) { if (r == 0) {
lauxgrid[i][j] = x;
rauxgrid[i][j] = o; rauxgrid[i][j] = o;
} else { } else {
lauxgrid[i][j] = o;
rauxgrid[i][j] = x; rauxgrid[i][j] = x;
} }
r = Math.floor(Math.random() * 2);
if (r == 0) {
lauxgrid[i][j] = o;
} else {
lauxgrid[i][j] = x;
}
} }
} }
} }