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