-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
41 lines (41 loc) · 1020 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="my.css">
</head>
<body>
<div align="center"><h1>Luck to win</h1></div>
<div align="center">
<input id="age" placeholder="enter number of stones" align="center"/>
<input type="button" onclick="mygame()" value="START" align="center"/>
</div>
<script>
function mygame()
{
var c;
var si;
var sii;
c=Number(document.getElementById("age").value);
while(c>=0)
{
if(c==0){
document.write("<h1>player-1 lose<h2>");
document.write("<h1>player-2 won<h2>");
break;
}
alert(c);
si=prompt("Now player-1 pick stones between 1-3");
c=c-si;
if(c==0){
document.write("<h1>player-1 won</h1>");
document.write("<h1>player-2 lose</h1>");
break;
}
alert(c);
sii=prompt("Now player-2 pick stones between 1-3");
c=c-sii;
}
}
</script>
</body>
</html>