|
@ -56,6 +56,7 @@ function gain(nb){ |
|
|
function affiche(){ |
|
|
function affiche(){ |
|
|
console.log('Vous avez gagné %d jetons', gains); |
|
|
console.log('Vous avez gagné %d jetons', gains); |
|
|
console.log('\nIl vous reste %d jetons, et il reste %d jetons dans le bac de la machine.\n', argent, bank); |
|
|
console.log('\nIl vous reste %d jetons, et il reste %d jetons dans le bac de la machine.\n', argent, bank); |
|
|
|
|
|
gains=0; |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
@ -77,18 +78,20 @@ document.querySelector("#spinner").addEventListener("click", spin); |
|
|
|
|
|
|
|
|
async function spin() { |
|
|
async function spin() { |
|
|
init(false, 1, 2); |
|
|
init(false, 1, 2); |
|
|
for (const door of doors) { |
|
|
if(argent>0){ |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
for (const door of doors) { |
|
|
const duration = parseInt(boxes.style.transitionDuration); |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
boxes.style.transform = "translateY(0)"; |
|
|
const duration = parseInt(boxes.style.transitionDuration); |
|
|
await new Promise((resolve) => setTimeout(resolve, duration * 100)); |
|
|
boxes.style.transform = "translateY(0)"; |
|
|
|
|
|
await new Promise((resolve) => setTimeout(resolve, duration * 100)); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
function init(firstInit, groups, duration) { |
|
|
function init(firstInit, groups, duration) { |
|
|
for (const door of doors) { |
|
|
for (const door of doors) { |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
const boxesClone = boxes.cloneNode(false); |
|
|
const boxesClone = boxes.cloneNode(false); |
|
|
const pool = ["❓"]; |
|
|
const pool = ["?"]; |
|
|
if (!firstInit) { |
|
|
if (!firstInit) { |
|
|
const arr = []; |
|
|
const arr = []; |
|
|
for (let n = 0; n < (groups > 0 ? groups : 1); n++) { |
|
|
for (let n = 0; n < (groups > 0 ? groups : 1); n++) { |
|
|