Browse Source

ça marche

master
gabrie.chataigner 3 years ago
parent
commit
acd0d31918
  1. 33
      code.js
  2. 1
      machinesous.html

33
code.js

@ -1,9 +1,6 @@
var nb1 = 0;
var nb2 = 0;
var nb3 = 0;
var mise = 0;
var bac = 0;
var jeton = 0;
function jeu(){
nbAlea();
@ -11,47 +8,53 @@ function jeu(){
}
function nbAlea() {
for (let i=0; i<10; i++) {
var nb1 = Math.floor(Math.random() * 10);
var nb2 = Math.floor(Math.random() * 10);
var nb3 = Math.floor(Math.random() * 10);
nb1 = Math.floor(Math.random() * 10);
nb2 = Math.floor(Math.random() * 10);
nb3 = Math.floor(Math.random() * 10);
document.getElementById("n1").innerHTML = nb1;
document.getElementById("n2").innerHTML = nb2;
document.getElementById("n3").innerHTML = nb3;
}
}
function gain() {
var mise = document.getElementById('mise').value;
var bac = document.getElementById('banque').innerHTML;
var jeton = document.getElementById('sous').innerHTML;
var mise = Number(document.getElementById('mise').value);
var bac = Number(document.getElementById('banque').innerHTML);
var jeton = Number(document.getElementById('sous').innerHTML);
console.log(nb1);
console.log(nb2);
console.log(nb3);
if (mise > 0 && mise <= 100 && mise <= jeton && bac > 0) {
bac = bac + mise;
jeton = jeton - mise
if (nb1 == 9 && nb2 == 9 && nb3 == 9){
jeton = jeton + bac;
bac = 0
} else if (nb1 == nb2 && nb2 == nb3) {
if (mise * 6 > bac) {
jeton = jeton + bac;
bac = 0;
} else {
jeton = jeton + 6 * mise;
bac = bac - 6 * mise;
jeton = jeton + (6*mise);
bac = bac - (6*mise);
}
} else if (nb1 == nb2 || nb2 == nb3 || nb1 == nb3) {
if (mise * 3 > bac) {
jeton = jeton + bac;
bac = 0;
} else {
jeton = jeton + mise * 3;
bac = bac - mise * 3;
jeton = jeton + (mise*3);
bac = bac - (mise*3);
}
}
}
document.getElementById("banque").innerHTML = bac;
document.getElementById("sous").innerHTML = jeton;
console.log(bac);
console.log(jeton);
}
function regles() {

1
machinesous.html

@ -8,6 +8,7 @@
</head>
<body>
<header>
<h1> MACHINE A SOUS</h1>
<p> Prêt à tenter sa chance ?</p>
<div class="imageD">

Loading…
Cancel
Save