|
@ -1,12 +1,3 @@ |
|
|
for (let i = 0; i < 10; i++) { |
|
|
|
|
|
console.log(i); |
|
|
|
|
|
for (var j = 0; j < 3; j++) { |
|
|
|
|
|
console.log(j); |
|
|
|
|
|
document.getElementsByClassName('cube__face--'+i)[j].style.transform = 'rotateX('+(i*36)+'deg) translateZ(calc(1.6vw /'+Math.tan(18* Math.PI / 180)+')'; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
let bac = 1000 |
|
|
let bac = 1000 |
|
|
let joueur = 100 |
|
|
let joueur = 100 |
|
|
let mise |
|
|
let mise |
|
@ -17,10 +8,53 @@ const tirageDom = document.getElementById("tirage") |
|
|
bacDom.innerText = bac |
|
|
bacDom.innerText = bac |
|
|
joueurDom.innerText = joueur |
|
|
joueurDom.innerText = joueur |
|
|
|
|
|
|
|
|
|
|
|
function nbAlea(){ |
|
|
|
|
|
return Math.floor(Math.random()*9); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
// Anime les rouleaux
|
|
|
|
|
|
function rotate(rouleau, angle){ |
|
|
|
|
|
let i = 0; |
|
|
|
|
|
let id = setInterval(() => { |
|
|
|
|
|
if (i >= angle) clearInterval(id); |
|
|
|
|
|
else { |
|
|
|
|
|
i += 9; |
|
|
|
|
|
rouleau.style.transform = 'rotate3d(1,0,0,'+i+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
}, 5); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Anime la tirette
|
|
|
|
|
|
function tirette(){ |
|
|
|
|
|
let i = 0; |
|
|
|
|
|
let id = setInterval(() => { |
|
|
|
|
|
if (i > 360) clearInterval(id); |
|
|
|
|
|
else { |
|
|
|
|
|
if (i > 180){ |
|
|
|
|
|
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+(360-i)+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+i+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
i += 9; |
|
|
|
|
|
} |
|
|
|
|
|
}, 20); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function tirage(){ |
|
|
|
|
|
let numbers = [nbAlea()+1, nbAlea()+1, nbAlea()+1] |
|
|
|
|
|
console.log(numbers) |
|
|
|
|
|
rotate(document.getElementsByClassName("cube")[0], Math.floor(Math.random() * 15)*360+(numbers[0]-1)*36) |
|
|
|
|
|
rotate(document.getElementsByClassName("cube")[1], Math.floor(Math.random() * 15)*360+(numbers[1]-1)*36) |
|
|
|
|
|
rotate(document.getElementsByClassName("cube")[2], Math.floor(Math.random() * 15)*360+(numbers[2]-1)*36) |
|
|
|
|
|
return numbers |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
function jeu(){ |
|
|
function jeu(){ |
|
|
mise = parseInt(document.getElementById("input").value) |
|
|
tirette() |
|
|
|
|
|
|
|
|
|
|
|
mise = parseInt(document.getElementById("mise_input").value) |
|
|
if(mise > 100 || mise < 0 || mise > joueur){ |
|
|
if(mise > 100 || mise < 0 || mise > joueur){ |
|
|
console.log("erreur: pas possible jouer") |
|
|
console.log("erreur: pas possible jouer") |
|
|
return |
|
|
return |
|
@ -28,13 +62,11 @@ function jeu(){ |
|
|
joueur -= mise |
|
|
joueur -= mise |
|
|
bac += mise |
|
|
bac += mise |
|
|
|
|
|
|
|
|
|
|
|
let tirageNumbers = tirage() //[2,1,2]
|
|
|
|
|
|
console.log(tirageNumbers) |
|
|
|
|
|
tirageDom.innerText = tirageNumbers |
|
|
|
|
|
|
|
|
let tirage = [2,1,2]//[nbAlea(), nbAlea(), nbAlea()];
|
|
|
let gain_retour = gain(tirageNumbers) |
|
|
tirageDom.innerText = tirage |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let gain_retour = gain(tirage) |
|
|
|
|
|
console.log(gain_retour) |
|
|
console.log(gain_retour) |
|
|
bac -= gain_retour |
|
|
bac -= gain_retour |
|
|
bacDom.innerText = bac |
|
|
bacDom.innerText = bac |
|
@ -46,10 +78,6 @@ function jeu(){ |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function nbAlea(){ |
|
|
|
|
|
let multiples = [36,72,108,144,180,216,252,288,324] |
|
|
|
|
|
return multiples[Math.floor(Math.random()*9)]; |
|
|
|
|
|
} |
|
|
|
|
|
function gain(tirage){ |
|
|
function gain(tirage){ |
|
|
if(tirage[0] == 9 && |
|
|
if(tirage[0] == 9 && |
|
|
tirage[1] == 9 && |
|
|
tirage[1] == 9 && |
|
@ -71,40 +99,11 @@ function regles(){ |
|
|
//afficher règles
|
|
|
//afficher règles
|
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
// Anime les rouleaux
|
|
|
for (let i = 0; i < 10; i++) { |
|
|
function rotate(rouleau, angle){ |
|
|
//console.log(i);
|
|
|
let i = 0; |
|
|
for (var j = 0; j < 3; j++) { |
|
|
let id = setInterval(() => { |
|
|
//console.log(j);
|
|
|
if (i >= angle) clearInterval(id); |
|
|
document.getElementsByClassName('cube__face--'+i)[j].style.transform = 'rotateX('+(i*36)+'deg) translateZ(calc(1.6vw /'+Math.tan(18* Math.PI / 180)+')'; |
|
|
else { |
|
|
} |
|
|
i += 9; |
|
|
|
|
|
rouleau.style.transform = 'rotate3d(1,0,0,'+i+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
}, 5); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Anime la tirette
|
|
|
|
|
|
function tirette(){ |
|
|
|
|
|
let i = 0; |
|
|
|
|
|
let id = setInterval(() => { |
|
|
|
|
|
if (i > 360) clearInterval(id); |
|
|
|
|
|
else { |
|
|
|
|
|
if (i > 180){ |
|
|
|
|
|
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+(360-i)+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
else { |
|
|
|
|
|
document.getElementById('tirette').style.transform = 'rotate3d(1,0,0,'+i+'deg)'; |
|
|
|
|
|
} |
|
|
|
|
|
i += 9; |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
|
|
}, 20); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function tirage(){ |
|
|
} |
|
|
rotate(document.getElementsByClassName("cube")[0], Math.floor(Math.random() * 15)*360+nbAlea()) |
|
|
|
|
|
rotate(document.getElementsByClassName("cube")[1], Math.floor(Math.random() * 15)*360+nbAlea()) |
|
|
|
|
|
rotate(document.getElementsByClassName("cube")[2], Math.floor(Math.random() * 15)*360+nbAlea()) |
|
|
|
|
|
} |
|
|
|
|
|
tirage() |
|
|
|