-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
99 lines (84 loc) · 3.15 KB
/
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
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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Play | Batu kertas Gunting</title>
<link rel="stylesheet" href="main_style.css">
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Poppins:ital,wght@0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
</head>
<body id="main_container" >
<div id="header">
<h1 class="header">Batu Kertas Gunting</h1>
</div>
<div id="hasil_container" class="result">
</div>
<div id="pilihan_container">
<ul class="nav">
<li onclick="pilih('batu')">👊</li>
<li onclick="pilih('kertas')">🖐️</li>
<li onclick="pilih('gunting')">✌️</li>
</ul>
</div>
</body>
<script>
var namaPemain ="main_player"
var namaBot ="bot"
var pilihanPemain
var pilihanBot
var hasil
var debug = false
var hasilContainer = document.getElementById("hasil_container");
function pilih(params){
pilihanPemain = params
if(debug == true){
console.log("xyzlog: " + namaPemain + " memilih " + pilihanPemain)
}
main()
}
function wasit(pilihanBot, pilihanPemain){
if(pilihanBot == "batu" && pilihanPemain == "kertas"){
document.getElementById("hasil_container").innerHTML
= "🖐️ VS 👊";
} else if (pilihanBot == "batu" && pilihanPemain == "gunting") {
document.getElementById("hasil_container").innerHTML
= "✌️ VS 👊";
} else if (pilihanBot == "kertas" && pilihanPemain == "batu") {
document.getElementById("hasil_container").innerHTML
= "👊 VS 🖐️";
} else if (pilihanBot == "kertas" && pilihanPemain == "gunting") {
document.getElementById("hasil_container").innerHTML
= "✌️ VS 🖐️";
} else if (pilihanBot == "gunting" && pilihanPemain == "batu") {
document.getElementById("hasil_container").innerHTML
= "👊 VS ✌️";
} else if (pilihanBot == "gunting" && pilihanPemain == "kertas") {
document.getElementById("hasil_container").innerHTML
= "🖐️ VS ✌️";
} else {
document.getElementById("hasil_container").innerHTML
= "Draw";
}
}
function otakBot(){
random = Math.floor(Math.random() * 3 ) + 1
if(random == 1){
pilihanBot = "batu"
} else if (random == 2){
pilihanBot = "kertas"
} else if (random == 3){
pilihanBot ="gunting"
}
if(debug == true){
console.log("xyzlog: " + namaBot + " memilih " + pilihanBot)
}
}
function main(){
otakBot()
wasit(pilihanBot, pilihanPemain)
}
</script>
</html>