Public
Edited
Feb 3, 2023
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
SVGIconInterval = Generators.observe((notify) => {
let n = 0;
let interval = setInterval(function () {
var setNum = new Array(3);
for (let i = 0; i < 3; i++) {
if (slotting[i]) {
setNum[i] = (i + n) % 5;
} else if (winNum > 0) {
setNum[i] = winNum - 1;
} else if (winNum == 0) {
setNum[i] = randomArray[i];
}
svgIcon[i]
.html(d3.select(svgArray[setNum[i]]).html())
.attr("viewBox", d3.select(svgArray[setNum[i]]).attr("viewBox"))
.attr("fill", d3.select(svgArray[setNum[i]]).attr("fill"))
.attr("width", "80%")
.attr("x", "10%")
.attr("y", 0);
}
n++;
notify(svgIcon);
}, 50);
return () => clearInterval(interval);
})
Insert cell
Insert cell
SlottingInterval = Generators.observe((notify) => {
let interval = setInterval(function () {
SetSlotting();
notify(slotting);
}, 2000);
return () => clearInterval(interval);
})
Insert cell
async function SetSlotting() {
var winLocal;
var typeLocal;
if (tradesArray.length > 0 && slotting[0]) {
winLocal = parseInt(tradesArray[0].amount * tradesArray[0].rate);
typeLocal = tradesArray[0].order_type;
tradesArray.splice(0, 1);
if (winLocal < 10000) {
mutable winNum = 1;
} else if (winLocal < 100000) {
mutable winNum = 2;
} else if (winLocal < 500000) {
mutable winNum = 3;
} else if (winLocal < 1000000) {
mutable winNum = 4;
} else {
mutable winNum = 5;
}
} else {
for (let i = 0; i < 3; i++) {
while (true) {
var tmp = randomNumber(0, 4);
if (!randomArray.includes(tmp)) {
randomArray[i] = tmp;
break;
}
}
}
winLocal = 0;
mutable winNum = 0;
}

for (let i = 0; i < 3; i++) {
slotting[i] = !slotting[i];
console.log(slotting[i]);
if (!slotting[i]) {
if (i == 2) {
mutable win = winLocal;
mutable credits += mutable win;
ShowType(typeLocal);
} else {
await _sleep(300);
}
}
}
}
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell
Insert cell

Purpose-built for displays of data

Observable is your go-to platform for exploring data and creating expressive data visualizations. Use reactive JavaScript notebooks for prototyping and a collaborative canvas for visual data exploration and dashboard creation.
Learn more