-
Notifications
You must be signed in to change notification settings - Fork 0
/
5x5.html
253 lines (244 loc) · 10.9 KB
/
5x5.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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
<!DOCTYPE html>
<head>
<title>Tic-Tac-Toe</title>
<meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">
<script src='js/main1.js'></script>
<link rel="stylesheet" href="dist/css/reset.css">
<link rel="stylesheet" href="dist/css/style.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.1/normalize.css">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link href="https://fonts.googleapis.com/css?family=Yeon+Sung&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=McLaren&display=swap" rel="stylesheet">
<style type="text/css">
body{
background-image: url(dist/assets/mars1.jpg);
background-repeat: no-repeat;
background-size: cover;
}
</style>
</head>
<body onload="openModal();">
<div class="navbar-container">
<a id="button-audio" onclick="audioFunction()" class=" nav-button">
<p id="icon-music" class="icon-2"><i class="fa fa-music"></i></p>
</a>
<a href="./rules.html" class="nav-button">
<p class="icon"><i class="fa fa-question"></i></p>
</a>
<a href="./index.html" class="nav-button">
<p class="icon"><i class="fa fa-home"></i></p>
</a>
</div>
<div class="navbar-container-2">
<a href="./1player.html" class="nav-button">
<p class="icon-2"><i class="fa fa-arrow-left" aria-hidden="true"></i></p>
</a>
</div>
<div id="modal" class="modal">
<div class="modal-content">
<span class="close">×</span>
<h1 class="subtitle">Time to Blast Off!!</h1>
<hr class="line">
<div class="how-to-content">
<p>Player who draws <b><span style="color:red">4 symbols</style></b> in a row first, whether horizontally, vertically or diagonally wins.</p>
<br>
<p><b>Advice:</b> Increase your chance of winning, by keeping your moves close to one another.</p>
<br>
<p><b>All the Best!!!</b></p>
</div>
</div>
</div>
<div class="content-container">
<h1 class="title-2">Mission Tic-Tac-Mars</h1>
<div class="board-container">
<div class="board-size">
<div class="size">
<button id="size3" onclick="function3()" class="button-size">3x3</button>
<button id="size4" onclick="function4()" class="button-size">4x4</button>
<button id="size5" onclick="function5()" class="button-size">5x5</button>
</div>
</div>
<div class="board-content">
<div class="row-board">
<img class="tile" src="images/blank2.png" onclick="makeMove(0)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(1)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(2)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(3)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(4)" />
</div>
<div class="row-board">
<img class="tile" src="images/blank2.png" onclick="makeMove(5)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(6)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(7)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(8)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(9)" />
</div>
<div class="row-board">
<img class="tile" src="images/blank2.png" onclick="makeMove(10)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(11)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(12)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(13)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(14)" />
</div>
<div class="row-board">
<img class="tile" src="images/blank2.png" onclick="makeMove(15)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(16)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(17)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(18)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(19)" />
</div>
<div class="row-board">
<img class="tile" src="images/blank2.png" onclick="makeMove(20)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(21)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(22)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(23)" />
<img class="tile" src="images/blank2.png" onclick="makeMove(24)" />
</div>
<input class="new-game" type="button" value="Replay" onclick="newboard()" />
</div>
<div class="info-game">
<p id="turnInfo"> We are heading to the red planet, Mars! </p>
</div>
</div>
</div>
<audio id="myAudio" allow='autoplay' loop='loop' loop>
<source src="music/cublak.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
</body>
<script>
function openModal(){
var modal = document.getElementById("modal");
// Get the <span> element that closes the modal
var span = document.getElementsByClassName("close")[0];
// When the user clicks the button, open the modal
modal.style.display = "flex";
// When the user clicks on <span> (x), close the modal
span.onclick = function () {
modal.style.display = "none";
newboard();
}
// When the user clicks anywhere outside of the modal, close it
window.onclick = function (event) {
if (event.target == modal) {
modal.style.display = "none";
newboard();
}
}
}
var x = document.getElementById("myAudio");
var checkAudio = true;
var property = document.getElementById("icon-music");
function audioFunction() {
if (checkAudio === true) {
property.style.color = "#F08732";
x.play();
checkAudio = false;
} else if (checkAudio === false) {
property.style.color = "#FFFFFF";
x.pause();
checkAudio = true;
}
}
function function3() {
let params = (new URL(document.location)).searchParams;
let name = params.get('name');
let level = params.get('level');
let size=params.get('size');
if (level === "very_easy"){
if (name === "computer") {
window.location.href = '3x3.html?name=computer&level=very_easy&size=3';
}else if (name === "human") {
window.location.href = '3x3.html?name=human&level=very_easy&size=3';
}
}
else if (level === "easy"){
if (name === "computer") {
window.location.href = '3x3.html?name=computer&level=easy&size=3';
}else if (name === "human") {
window.location.href = '3x3.html?name=human&level=easy&size=3';
}
}
else if (level === "medium"){
if (name === "computer") {
window.location.href = '3x3.html?name=computer&level=medium&size=3';
}else if (name === "human") {
window.location.href = '3x3.html?name=human&level=medium&size=3';
}
}
else {
if (name === "computer") {
window.location.href = '3x3.html?name=computer&size=3';
}else if (name === "human") {
window.location.href = '3x3.html?name=human&size=3';
}
}
}
function function4() {
let params = (new URL(document.location)).searchParams;
let name = params.get('name');
let level = params.get('level');
if (level === "very_easy"){
if (name === "computer") {
window.location.href = '4x4.html?name=computer&level=very_easy&size=4';
}else if (name === "human") {
window.location.href = '4x4.html?name=human&level=very_easy&size=4';
}
}
else if (level === "easy"){
if (name === "computer") {
window.location.href = '4x4.html?name=computer&level=easy&size=4';
}else if (name === "human") {
window.location.href = '4x4.html?name=human&level=easy&size=4';
}
}
else if (level === "medium"){
if (name === "computer") {
window.location.href = '4x4.html?name=computer&level=medium&size=4';
}else if (name === "human") {
window.location.href = '4x4.html?name=human&level=medium&size=4';
}
}
else {
if (name === "computer") {
window.location.href = '4x4.html?name=computer&size=4';
}else if (name === "human") {
window.location.href = '4x4.html?name=human&size=4';
}
}
}
function function5() {
let params = (new URL(document.location)).searchParams;
let name = params.get('name');
let level = params.get('level');
if (level === "very_easy"){
if (name === "computer") {
window.location.href = '5x5.html?name=computer&level=very_easy&size=5';
}else if (name === "human") {
window.location.href = '5x5.html?name=human&level=very_easy&size=5';
}
}
else if (level === "easy"){
if (name === "computer") {
window.location.href = '5x5.html?name=computer&level=easy&size=5';
}else if (name === "human") {
window.location.href = '5x5.html?name=human&level=easy&size=5';
}
}
else if (level === "medium"){
if (name === "computer") {
window.location.href = '5x5.html?name=computer&level=medium&size=5';
}else if (name === "human") {
window.location.href = '5x5.html?name=human&level=medium&size=5';
}
}
else {
if (name === "computer") {
window.location.href = '5x5.html?name=computer&size=5';
}else {
window.location.href = '5x5.html?name=human&size=5';
}
}
}
</script>
</html>