You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
71 lines
1.5 KiB
71 lines
1.5 KiB
//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('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);
|
|
}
|
|
|
|
|
|
|
|
|