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.
46 lines
882 B
46 lines
882 B
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
|
|
}
|