|
@ -6,7 +6,7 @@ let mise |
|
|
let gains = 0 |
|
|
let gains = 0 |
|
|
|
|
|
|
|
|
function start(){ |
|
|
function start(){ |
|
|
argent = document.getElementById("input").value; |
|
|
argent = document.getElementById("argent").value; |
|
|
regle(); |
|
|
regle(); |
|
|
test(); |
|
|
test(); |
|
|
} |
|
|
} |
|
@ -21,8 +21,53 @@ function regle(){ |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function saisie(){ |
|
|
function saisie(){ |
|
|
mise = document.getElementById("argent").value; |
|
|
mise = document.getElementById("mise").value; |
|
|
bank += mise; |
|
|
bank+=Number(mise); |
|
|
argent -= mise; |
|
|
argent-=Number(mise); |
|
|
console.log(bank) |
|
|
nb_alea(); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function nb_alea(){ |
|
|
|
|
|
var random_1 = Math.floor(Math.random() * (10 - 1)) + 1; |
|
|
|
|
|
var random_2 = Math.floor(Math.random() * (10 - 1)) + 1; |
|
|
|
|
|
var random_3 = Math.floor(Math.random() * (10 - 1)) + 1; |
|
|
|
|
|
gain(random_1, random_2, random_3); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function gain(random_1, random_2, random_3){ |
|
|
|
|
|
if (random_1==random_2 && random_2==random_3 && random_3==9) { |
|
|
|
|
|
argent+=bank; |
|
|
|
|
|
bank-=bank; |
|
|
|
|
|
gains+=bank; |
|
|
|
|
|
console.log("Bingo"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if(random_1==random_2 && random_2==random_3){ |
|
|
|
|
|
argent+=6*Number(mise); |
|
|
|
|
|
bank-=6*Number(mise); |
|
|
|
|
|
gains+=6*Number(mise); |
|
|
|
|
|
console.log("trois égaux"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else if(random_1==random_2||random_2==random_3||random_3==random_1){ |
|
|
|
|
|
argent+=3*Number(mise); |
|
|
|
|
|
bank-=3*Number(mise); |
|
|
|
|
|
gains+=3*Number(mise); |
|
|
|
|
|
console.log("deux égaux"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
else{ |
|
|
|
|
|
console.log("aucun égaux"); |
|
|
|
|
|
} |
|
|
|
|
|
affiche(random_1, random_2, random_3); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function affiche(random_1, random_2, random_3){ |
|
|
|
|
|
console.log(random_1,random_2, random_3, bank, gains, argent); |
|
|
|
|
|
let message_1 = 'premier rouleau : '+random_1',deuxième rouleaux : '+random_2',troisième rouleaux '; |
|
|
|
|
|
console.log('Vous avez gagné ${gains} jetons'); |
|
|
|
|
|
console.log('\nIl vous reste ${argent} jetons, et il reste ${bank} jetons dans le bac de la machine.\n'); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|