-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathindex.html
181 lines (179 loc) · 9.03 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
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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>GeoRETRO Memory Matching Game</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<header>
<h1>GEORETRO Memory Game <span></h1>
<span class="tool-tip">
<button aria-label="how to play" onClick="openHelpModal()">
<svg width="40" height="40">
<circle cx="20" cy="20" r="15" stroke-width="2" fill="#000000" />
<text x="50%" y="50%" text-anchor="middle" fill="white" font-size="1em" dy=".4em">❓</text>
❓
</svg>
</button>
<span class="tool-tip-text">Instructions</span>
</span>
</header>
<main>
<section style="background-image: url('./img/space.jpg');">
<div class="game-status-details">
<div class="rating">
<span class="star">🌟</span>
<span class="star">🌟</span>
<span class="star">🌟</span>
<span class="star">🌟</span>
<span class="star">🌟</span>
</div>
<span class="move-counter" id="moveCounter"></span>
<span class="timer" id="timer">0 mins 0 secs</span>
<button class="restart-btn" id="restartBtn" onClick="startGame()" aria-label="restart game">↻</button>
</div>
<table class="game-board">
<tbody class="game-grid">
<tr class="game-grid-row">
<td class="game-card">
<img class="game-card-img" src="img/1.jpg" alt="cake1">
</td>
<td class="game-card">
<img class="game-card-img" src="img/2.jpg" alt="cake2">
</td>
<td class="game-card">
<img class="game-card-img" src="img/3.jpg" alt="cake3">
</td>
<td class="game-card">
<img class="game-card-img" src="img/4.jpg" alt="cake4">
</td>
</tr>
<tr class="game-grid-row">
<td class="game-card">
<img class="game-card-img" src="img/5.jpg" alt="cake5">
</td>
<td class="game-card">
<img class="game-card-img" src="img/6.jpg" alt="cake6">
</td>
<td class="game-card">
<img class="game-card-img" src="img/7.jpg" alt="cake7">
</td>
<td class="game-card">
<img class="game-card-img" src="img/8.jpg" alt="cake8">
</td>
</tr>
<tr class="game-grid-row">
<td class="game-card">
<img class="game-card-img" src="img/1.jpg" alt="cake1">
</td>
<td class="game-card">
<img class="game-card-img" src="img/2.jpg" alt="cake2">
</td>
<td class="game-card">
<img class="game-card-img" src="img/3.jpg" alt="cake3">
</td>
<td class="game-card">
<img class="game-card-img" src="img/4.jpg" alt="cake4">
</td>
</tr>
<tr class="game-grid-row">
<td class="game-card">
<img class="game-card-img" src="img/5.jpg" alt="cake5">
</td>
<td class="game-card">
<img class="game-card-img" src="img/6.jpg" alt="cake6">
</td>
<td class="game-card">
<img class="game-card-img" src="img/7.jpg" alt="cake7">
</td>
<td class="game-card">
<img class="game-card-img" src="img/8.jpg" alt="cake8">
</td>
</tr>
</tbody>
</table>
<div class="restart-button-div">
<button class="restart-button brown-button" id="restartButton" onClick="startGame()">Restart ↻</button>
</div>
</section>
<!--Modal on game over -->
<div class="modal" id="gameOverModal">
<div class="modal-content">
<span aria-label="close" role="button" class="close" id="closeModal">×</span>
<div class="modal-header">
<h2>Game Over</h2>
</div>
<div class="modal-body">
<div class="message">
<p>Congratulations! <span class="game-over-icons">🎊 🎊 🎊</span> You Win. <span class="game-over-icons" style="animation-delay: 0.2s">🎉 🎉 🎉</span></p>
<p>You completed the game using <span id="totalGameMoves"></span> moves
<br>in <span id="totalGameTime"></span>
</p>
<p>Your rating is: <span id="finalStarRating"></span></p>
</div>
</div>
<div class="modal-footer">
<button class="brown-button" onClick="playAgain()">Play Again 😀</button>
</div>
</div>
</div>
<!-- Modal to display Game Instructions -->
<div class="modal" id="helpModal">
<div class="modal-content">
<span aria-label="close" role="button" class="close" onClick="closeHelpModal()">×</span>
<div class="modal-header">
<h2>How to Play</h2>
</div>
<div class="modal-body">
<div class="help-tips">
<p>This is a Matching Game used to test your memory retention abilities</p>
<p>The game consists of:</p>
<ul>
<li>♦ A game board with 16 cards - 8 matching pairs of cards</li>
<li>♦ A game status indicator which consists of :
<ul>
<li>⋄ A rating indicator - A list of stars which indicates your rating based on the number of your moves.</li>
<li>⋄ A move counter - Indicates the number of moves you've made.</li>
<li>⋄ A timer - Indicates the total number of time you take to match all cards.</li>
<li>⋄ A restart button.</li>
</ul>
</li>
<li>♦ A larger restart button.</li>
</ul>
<p>When the page loads the game starts.</p>
<p>All the 8 pairs of cards i.e 16 cards are flashed</p>
<p>How to play:</p>
<ul>
<li>• Click on a black square to reveal the card</li>
<li>• Click on a second black square to reveal the card
<ul>
<li>a. If the two cards match, the cards stay revealed.</li>
<li>b. If there is no match, the cards are hidden and you can click another pair.</li>
</ul>
</li>
<li>• You can click either of the restart buttons <em>↻</em> or <em>Restart ↻</em> at any point in time to start all over.</li>
<li>• When you have correctly matched all 8 pairs of cards, the game ends and your total game time, total number of moves and rating will be displayed.</li>
<li>• You can click the <em>Play Again</em> in the modal that pops up to start a new game.</li>
</ul>
</div>
</div>
<div class="modal-footer">
<button class="brown-button" onClick="closeHelpModal()">Close</button>
</div>
</div>
</div>
</main>
<footer>
<div class="page-footer">
<p>
<span aria-label="copyright">©</span> 2019.
</p>
</div>
</footer>
<script src="main.js"></script>
<noscript>Oops!!! Sorry, you cannot play this game. Your broswer does not support Javascript.</noscript>
</body>
</html>