Browse Source

app.js

master
michel.wang 3 years ago
parent
commit
a72ef06761
  1. 14
      app.js
  2. 4
      index.html

14
app.js

@ -23,14 +23,22 @@ var player_coins = 100
function nbAlea() { function nbAlea() {
return Math.floor(Math.random() * 10); return Math.floor(Math.random() * 10);
} }
var tirage = [nbAlea(), nbAlea(), nbAlea()] var tirage = [nbAlea(), nbAlea(), nbAlea()]
function gain(tirage) { function gain(tirage) {
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 { } else if(tirage[0] == tirage[1] == tirage[2]) {
} else if { } else if(tirage[0] == tirage[1] || tirage[1] == tirage[2] || tirage[0] == tirage[2]) {
}
} var button = document.createElement("BUTTON");
var button_1 = document.createTextNode("CLICK ME");
function regle() {
btn.appendChild(button_1);
document.body.appendChild(button);
} }

4
index.html

@ -1,11 +1,13 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="fr"> <html lang="fr">
<head> <head>
<link href="style.css" rel="stylesheet">
<meta charset="UTF-8"> <meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title> <title>Document</title>
</head> </head>
<body> <body>
<script src="app.js"></script> <h1 onclick="regle()">MACHINE A SOUS NSI</h1>
<script src="app.js"></script>
</body> </body>
</html> </html>
Loading…
Cancel
Save