-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
67 lines (66 loc) · 2 KB
/
index.js
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
let Matchcount=0;
let winCount=0;
let looseCount=0;
let tieCount=0;
function userData(e){
Matchcount++;
let computer=Math.floor(Math.random() * (4-1) + 1);
if(e==1){
document.getElementById("u1").style.display="flex";
}
else{
document.getElementById("u1").style.display="none";
}
if(e==2){
document.getElementById("u2").style.display="flex";
}
else{
document.getElementById("u2").style.display="none";
}
if(e==3){
document.getElementById("u3").style.display="flex";
}
else{
document.getElementById("u3").style.display="none";
}
if(computer==1){
document.getElementById("c1").style.display="flex";
}
else{
document.getElementById("c1").style.display="none";
}
if(computer==2){
document.getElementById("c2").style.display="flex";
}
else{
document.getElementById("c2").style.display="none";
}
if(computer==3){
document.getElementById("c3").style.display="flex";
}
else{
document.getElementById("c3").style.display="none";
}
if(computer==1 && e==2 || computer==2 && e==3 || computer==3 && e==1){
winCount++;
document.getElementById("ans").style.display="flex";
document.getElementById("answer").innerHTML="YOU WON!!";
}
else if(computer==e){
tieCount++;
document.getElementById("ans").style.display="flex";
document.getElementById("answer").innerHTML="MATCH TIE!!";
}
else{
looseCount++;
document.getElementById("ans").style.display="flex";
document.getElementById("answer").innerHTML="YOU LOOSE!!";
}
document.getElementById("matchCount").innerHTML=Matchcount;
document.getElementById("winCount").innerHTML=winCount;
document.getElementById("looseCount").innerHTML=looseCount;
document.getElementById("tieCount").innerHTML=tieCount;
}
function reset(){
location.reload();
}