|
|
|
//let machine_sous = new Object();
|
|
|
|
let argent
|
|
|
|
let nombres = []
|
|
|
|
let bank = 1000
|
|
|
|
let mise
|
|
|
|
let gains = 0
|
|
|
|
|
|
|
|
function start(){
|
|
|
|
argent = document.getElementById("argent").value;
|
|
|
|
regle();
|
|
|
|
test();
|
|
|
|
}
|
|
|
|
|
|
|
|
function test(){
|
|
|
|
console.log(argent)
|
|
|
|
}
|
|
|
|
|
|
|
|
function regle(){
|
|
|
|
console.log("les règles sont ..............");
|
|
|
|
console.log("Mais aussi ça .............");
|
|
|
|
}
|
|
|
|
|
|
|
|
function saisie(){
|
|
|
|
mise = document.getElementById("mise").value;
|
|
|
|
bank+=Number(mise);
|
|
|
|
argent-=Number(mise);
|
|
|
|
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');
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|