|
@ -1,41 +1,34 @@ |
|
|
<!DOCTYPE html> |
|
|
<!DOCTYPE html> |
|
|
<html> |
|
|
<html> |
|
|
|
|
|
<head> |
|
|
|
|
|
<title>casinoooooo</title> |
|
|
|
|
|
<meta charset="utf-8"> |
|
|
|
|
|
<link href="style.css" rel="stylesheet"> |
|
|
|
|
|
</head> |
|
|
<body> |
|
|
<body> |
|
|
<input type="text" id="name" |
|
|
<h1><marquee width="600" scrollamount="600"scrolldelay="500">casino jackpot </marquee></h1> |
|
|
|
|
|
|
|
|
|
|
|
<input type="number" id="name" |
|
|
minlength="4" maxlength="8" size="10" required> |
|
|
minlength="4" maxlength="8" size="10" required> |
|
|
<button onclick="lancement()">lance le jeu</button> |
|
|
<input type="button" value="Démarrer la machine" onclick="nbAlea()"> |
|
|
|
|
|
|
|
|
<p id="demo"></p> |
|
|
<p id="demo"></p> |
|
|
<script> |
|
|
<script> |
|
|
|
|
|
|
|
|
var jeton_bac=1000; |
|
|
var jeton_bac=1000; |
|
|
|
|
|
|
|
|
var jeton_joueur=99; |
|
|
var jeton_joueur=99; |
|
|
|
|
|
var nb_jet = document.getElementById("name").value; |
|
|
function lancement() { |
|
|
|
|
|
let nb_jet = document.getElementById("name").value; |
|
|
|
|
|
if (jeton_joueur > nb_jet && jeton_bac > 500 && nb_jet < 100 && nb_jet> 0){ |
|
|
|
|
|
nbAlea(); |
|
|
|
|
|
return nb_jet; |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
document.getElementById("demo").innerHTML = "la saisie n'est pas valide"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
function gain(x){ |
|
|
function gain(x){ |
|
|
let nb_jet=lancement() |
|
|
|
|
|
let resultat=x |
|
|
let resultat=x |
|
|
if (resultat==1){ |
|
|
if (resultat==1){ |
|
|
let jeton_joueur=jeton_joueur+jeton_joueur ; |
|
|
var jeton_joueur=jeton_joueur+jeton_bac ; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_joueur+" jetons"; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_joueur+" jetons"; |
|
|
} |
|
|
} |
|
|
else if (resultat==2){ |
|
|
else if (resultat==2){ |
|
|
let jeton_joueur=5*nb_jet ; |
|
|
var jeton_joueur=5*nb_jet ; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_joueur+" jetons"; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_joueur+" jetons"; |
|
|
var jeton_bac=jeton_bac-5*nb_jet; |
|
|
var jeton_bac=jeton_bac-5*nb_jet; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_bac+" jetons"; |
|
|
document.getElementById("demo").innerHTML = "vous avez "+jeton_bac+" jetons"; |
|
|
return jeton_joueur; |
|
|
return jeton_joueur; |
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
else if (resultat==3){ |
|
|
else if (resultat==3){ |
|
|
var jeton_joueur=jeton_joueur-nb_jet ; |
|
|
var jeton_joueur=jeton_joueur-nb_jet ; |
|
@ -45,32 +38,31 @@ function gain(x){ |
|
|
return jeton_joueur; |
|
|
return jeton_joueur; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
function nbAlea(){ |
|
|
function nbAlea(){ |
|
|
|
|
|
if (jeton_joueur > nb_jet && jeton_bac > 500 && nb_jet < 100 && nb_jet> 0 ) |
|
|
|
|
|
{ |
|
|
const cars = [Math.floor(Math.random() * 10) , |
|
|
const cars = [Math.floor(Math.random() * 10) , |
|
|
Math.floor(Math.random() * 10) , |
|
|
Math.floor(Math.random() * 10) , |
|
|
Math.floor(Math.random() * 10) ]; |
|
|
Math.floor(Math.random() * 10) ]; |
|
|
return cars; |
|
|
|
|
|
} |
|
|
|
|
|
let cars = nbAlea(); |
|
|
|
|
|
window.alert(cars); |
|
|
window.alert(cars); |
|
|
if(cars[0]==9&&cars[1]==9&&cars[2]==9){ |
|
|
if(cars[0]==9&&cars[1]==9&&cars[2]==9){ |
|
|
gain(1); |
|
|
gain(1); |
|
|
} |
|
|
} |
|
|
else if(cars[0]==cars[1]||cars[0]==cars[2]||cars[1]==cars[2]){ |
|
|
else if(cars[0]==cars[1]||cars[0]==cars[2]||cars[1]==cars[2]) |
|
|
|
|
|
{ |
|
|
gain(2); |
|
|
gain(2); |
|
|
} |
|
|
} |
|
|
else if (cars[0]!=cars[1]||cars[0]!=cars[2]||cars[1]!=cars[2]){ |
|
|
else if (cars[0]!=cars[1]||cars[0]!=cars[2]||cars[1]!=cars[2]){ |
|
|
gain(3); |
|
|
gain(3); |
|
|
} |
|
|
} |
|
|
|
|
|
} |
|
|
|
|
|
else{ |
|
|
|
|
|
document.getElementById("demo").innerHTML = "la saisie n'est pas valide"; |
|
|
|
|
|
} |
|
|
|
|
|
} |
|
|
</script> |
|
|
</script> |
|
|
</body> |
|
|
</body> |
|
|
</html> |
|
|
</html> |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|