alexandre.aboulin
3 years ago
commit
f0bc95ff55
2 changed files with 69 additions and 0 deletions
@ -0,0 +1,46 @@ |
|||
let bac = 1000 |
|||
let joueur = 100 |
|||
let mise |
|||
|
|||
function jeu(){ |
|||
mise = getMise() |
|||
if(mise > 100 || mise < 0 || mise > joueur){ |
|||
//erreur
|
|||
return |
|||
} |
|||
joueur -= mise |
|||
bac += mise |
|||
let gain_retour = gain([nbAlea(), nbAlea(), nbAlea]) |
|||
bac -= gain_retour |
|||
joueur += gain_retour |
|||
if(bac < 500){ |
|||
//stop
|
|||
} |
|||
} |
|||
|
|||
function nbAlea(){ |
|||
return Math.random()*10 |
|||
} |
|||
function gain(tirage){ |
|||
if(tirage[0] == 9 && |
|||
tirage[1] == 9 && |
|||
tirage[2] == 9){ |
|||
return bac |
|||
} |
|||
else if(tirage[0] == tirage[1] && |
|||
tirage[1] == tirage[2]){ |
|||
return mise*6 |
|||
} |
|||
else if(tirage[0] == tirage[1] || |
|||
tirage[0] == tirage[2] || |
|||
tirage[1] == tirage[2]){ |
|||
return mise*3 |
|||
} |
|||
return 0 |
|||
} |
|||
function getMise(){ |
|||
document.getElementById("input").value |
|||
} |
|||
function regles(){ |
|||
//afficher
|
|||
} |
@ -0,0 +1,23 @@ |
|||
<!DOCTYPE html> |
|||
<html lang="fr"> |
|||
<head> |
|||
<meta charset="UTF-8"> |
|||
<meta http-equiv="X-UA-Compatible" content="IE=edge"> |
|||
<meta name="viewport" content="width=device-width, initial-scale=1.0"> |
|||
<title>Document</title> |
|||
</head> |
|||
<body> |
|||
<div id="tirage"> |
|||
<span></span> |
|||
<span></span> |
|||
<span></span> |
|||
</div> |
|||
|
|||
<p>Banque : <span id="banque_score"></span></p> |
|||
<p>Vous : <span id="joueur_score"></span></p> |
|||
|
|||
<input type="text" id="input"> |
|||
<button id="lancer" onclick="jeu()">Lancer</button> |
|||
<script src="app.js"></script> |
|||
</body> |
|||
</html> |
Loading…
Reference in new issue