|
|
@ -19,18 +19,25 @@ function nbAlea() { |
|
|
|
} |
|
|
|
|
|
|
|
function gain(tirage) { |
|
|
|
player_coins = player_coins - mise |
|
|
|
machine_coins = machine_coins + mise |
|
|
|
if (tirage == [9,9,9]) { |
|
|
|
player_coins = player_coins + machine_coins |
|
|
|
machine_coins = 0 |
|
|
|
} else if (tirage[0] == tirage[1] && tirage[1]== tirage[2]) { |
|
|
|
console.log("E") |
|
|
|
player_coins = player_coins + 6*mise |
|
|
|
machine_coins = machine_coins - 6*mise |
|
|
|
} else if (tirage[0] == tirage[1] || tirage[1] == tirage[2] || tirage[0] == tirage[2]) { |
|
|
|
console.log("K") |
|
|
|
player_coins = player_coins + 2*mise |
|
|
|
machine_coins = machine_coins - 2*mise |
|
|
|
} else { |
|
|
|
console.log("Perdu") |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
function update_stats() { |
|
|
|
document.getElementById('machine_coins').innerText = machine_coins |
|
|
|
document.getElementById('player_coins').innerText = player_coins |
|
|
|
} |
|
|
|
/* |
|
|
|
var button = document.createElement("BUTTON"); |
|
|
|
var button_1 = document.createTextNode("CLICK ME"); |
|
|
@ -44,10 +51,11 @@ var player_coins = 100 |
|
|
|
function jeu() { |
|
|
|
|
|
|
|
if (player_coins > 0) { |
|
|
|
userinput = document.getElementById("mise").value // a dev
|
|
|
|
console.log(userinput) |
|
|
|
var mise = document.getElementById("mise").value // a dev
|
|
|
|
console.log(mise) |
|
|
|
var tirage = [nbAlea(), nbAlea(), nbAlea()] |
|
|
|
console.log(tirage) |
|
|
|
gain(tirage) |
|
|
|
update_stats() |
|
|
|
} |
|
|
|
} |
|
|
|