|
@ -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,6 +78,7 @@ document.querySelector("#spinner").addEventListener("click", spin); |
|
|
|
|
|
|
|
|
async function spin() { |
|
|
async function spin() { |
|
|
init(false, 1, 2); |
|
|
init(false, 1, 2); |
|
|
|
|
|
if(argent>0){ |
|
|
for (const door of doors) { |
|
|
for (const door of doors) { |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
const boxes = door.querySelector(".boxes"); |
|
|
const duration = parseInt(boxes.style.transitionDuration); |
|
|
const duration = parseInt(boxes.style.transitionDuration); |
|
@ -84,11 +86,12 @@ async function spin() { |
|
|
await new Promise((resolve) => setTimeout(resolve, duration * 100)); |
|
|
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++) { |
|
|