diff --git a/main.js b/main.js
index 83dc080..8858e59 100644
--- a/main.js
+++ b/main.js
@@ -6,7 +6,7 @@ let mise
let gains = 0
function start(){
- argent = document.getElementById("input").value;
+ argent = document.getElementById("argent").value;
regle();
test();
}
@@ -21,8 +21,53 @@ function regle(){
}
function saisie(){
- mise = document.getElementById("argent").value;
- bank += mise;
- argent -= mise;
- console.log(bank)
-}
\ No newline at end of file
+ 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');
+}
+
+
+
diff --git a/test.html b/test.html
index d777a5a..eec2fd1 100644
--- a/test.html
+++ b/test.html
@@ -14,10 +14,10 @@
-
+
-
+