generated from Code-Institute-Org/gitpod-full-template
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.html
300 lines (299 loc) · 18.1 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
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
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="author" content="Tom Haysom (thaysom22)">
<meta name="description" content="Substitution Skirmish! A two player competitive math game for middle school students to practice substituting into and evaluating algebraic expressions">
<meta name="application-name" content="Substitution Skirmish!">
<title>Substitution Skirmish! 2 Player Math Game</title>
<!-- Local stylesheet -->
<link rel="stylesheet" href="assets/css/styles.css">
<!-- JS for Font Awesome -->
<script src="https://kit.fontawesome.com/36aca6d9b6.js" crossorigin="anonymous"></script>
<!-- Load jQuery (slim build) -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.slim.min.js" integrity="sha512-/DXTXr6nQodMUiq+IUJYCt2PPOUjrHJ9wFrqpJ3XkgPNOZVfMok7cRw6CSxyCQxXn6ozlESsSh1/sMCTF1rL/g==" crossorigin="anonymous"></script>
<!-- Load mathJax library from jsdelivr cdn for rendering mathematical expressions -->
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>
<!-- Load mathjs library from cdnjs so math object is available -->
<script src="https://cdnjs.cloudflare.com/ajax/libs/mathjs/8.1.1/math.js" integrity="sha512-OFr0yNTrn4TBOCW8hAkqVRjN45OYD4C3Zv3JA+/UFDW7rEjt7RV89OfUinLg/9GzHbUWYq1+jXzgVV/UsZWJHQ==" crossorigin="anonymous"></script>
<!-- Local main.js (automatically deferred) -->
<script src="assets/js/main.js" type="module"></script>
</head>
<body class="modal-open">
<div id="grid-container-body" class="hide">
<!-- Main heading section -->
<header id="header-wrapper" class="section-wrapper">
<h1 id="main-heading" class="heading">Substitution Skirmish!</h1>
<div id="header-info-wrapper" class="trigger-wrapper" title="How to Play" aria-label="Click to view instructions on how to play">
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-info-circle"></i>
<span>How to Play</span>
</div>
</header>
<div class="hide info-contents" aria-label="Instructions on how to play" title="Instructions">
<ol>
<li>Enter names for both players and choose a difficulty level</li>
<li>Player 1 clicks on ? icon to generate a random number for the value of x</li>
<li>Player 1 chooses an expression from the grid and then enters the value of the expression for their x</li>
<li>When player 1 enters a value, it is the end of their turn and the expression they chose is removed from the grid</li>
<li>Higher value correct answers gain more points</li>
<li>If answer is incorrect, player loses a point for turn</li>
<li>Player 2 begins their turn</li>
<li>Once player 2 runs out of turns, the game is over and the player with the highest score wins!</li>
</ol>
</div>
<!-- Click to play section -->
<section id="click-to-play-wrapper" class="section-wrapper">
<span id="current-player-name"></span>
<div id="random-number-wrapper" class="trigger-wrapper" aria-label="Click to play" title="Click to play">
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-question" aria-label="Click to start turn"></i>
<span id="variable-value" class="hide" aria-label="Random number"></span>
</div>
<div id="counttimer-wrapper" class="trigger-wrapper">
<p id="click-to-play-instruction">Click to Play!</p>
</div>
</section>
<!-- Scoreboard section -->
<section id="scoreboards-wrapper" class="section-wrapper">
<div id="player1-scoreboard" class="player-scoreboard" title="player 1 scoreboard" aria-label="player 1 scoreboard">
<h4 class="scoreboard-title">player1Name</h4>
<div class="main-score">
<div class="score-turns">
<span class="value"></span>
<span class="label">TURNS</span>
</div>
<span class="value"></span>
<span class="label">SCORE</span>
</div>
</div>
<div id="player2-scoreboard" class="player-scoreboard" title="player 2 scoreboard" aria-label="player 2 scoreboard">
<h4 class="scoreboard-title">player2Name</h4>
<div class="main-score">
<div class="score-turns">
<span class="value"></span>
<span class="label">TURNS</span>
</div>
<span class="value"></span>
<span class="label">SCORE</span>
</div>
</div>
</section>
<!-- Main gameboard section -->
<section id="gameboard-wrapper" class="section-wrapper">
<!-- gameboard overlay - hidden until grid item is clicked during a player turn -->
<div id="gameboard-overlay" class="hide" aria-label="gameboard anwser question">
<div id="gameboard-overlay-content">
<div id="gameboard-active-question">
<span aria-label="chosen mathematical expression" title="chosen mathematical expression"></span>
</div>
<h3>Evaluate when x = <span id="variable-value-overlay"></span></h3>
<form>
<input type="text" id="player-answer" name="playerAnswer" size="4" aria-label="Enter answer here" title="Enter answer here">
<span id="player-answer-error-message" aria-label="Answer error message" title="Answer error message"></span>
<button id="submit-player-answer-button" type="submit" title="Submit answer" aria-label="submit answer">Enter</button>
<button id="choose-again-button" type="button" title="Choose again" aria-label="Choose again">Choose again</button>
</form>
<div id="answer-feedback" class="hide" aria-label="feedback on answer">
<i></i>
<span class="feedback1"></span>
<span class="feedback2"></span>
<span class="feedback3"></span>
</div>
</div>
</div>
<div id="gameboard-grid-container">
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
<div class="gameboard-grid-item"><span class="grid-expression"></span></div>
</div>
</section>
<!-- Footer section -->
<footer id="footer-wrapper" class="section-wrapper">
<!-- On page load about-trigger has plus icon and footer content is not visible -->
<div id="about-trigger-wrapper" class="trigger-wrapper" aria-label="view ABOUT section content" title="view ABOUT section content">
<span>ABOUT</span>
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-plus-square"></i>
</div>
<div id="about-content-wrapper" class="section-wrapper hide">
<div id="dev-portfolio-wrapper">
<a href="https://thaysom22.github.io/portfolio_project/" target="_blank" aria-label="Click to open Thomas Haysom Developer Portfolio" title="Thomas Haysom - Developer Portfolio">
<i class="far fa-file" aria-hidden="true" title="Click to open developer portfolio"></i>
<span>thaysom22</span>
<span>Developer Portfolio</span>
</a>
</div>
<div id="copyright-wrapper">
<span>For eductional purposes only</span>
<span>© Thomas Haysom 2020</span>
</div>
<div id="github-repo-wrapper">
<a href="https://github.com/thaysom22/maths-substitution-game" target="_blank" aria-label="Click to open GitHub repo for this site" title="GitHub Repo: maths-substitution-game">
<i class="fab fa-github-square" aria-hidden="true" title="Click to open GitHub repo for this site"></i>
<span>Code for this site</span>
<span>Suggestions welcome!</span>
</a>
</div>
</div>
</footer>
</div>
<!-- MODALS -->
<!-- Welcome modal - open when document is loaded in browser -->
<div class="modal" id="welcome-modal" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-label="Welcome modal" aria-hidden="true">
<div class="modal-content">
<!-- Main heading section within modal -->
<header class="section-wrapper modal-header-wrapper">
<h1 class="heading modal-main-heading">Substitution Skirmish!</h1>
<div class="trigger-wrapper modal-header-info-wrapper" title="How to Play" aria-label="instructions on how to play">
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-info-circle"></i>
<span>How to Play</span>
</div>
</header>
<div class="hide info-contents" title="Instructions" aria-label="Instructions on how to play">
<ol>
<li>Enter names for both players and choose a difficulty level</li>
<li>Player 1 clicks on ? icon to generate a random number for the value of x</li>
<li>Player 1 chooses an expression from the grid and then enters the value of the expression for their x</li>
<li>If player 1 tires to evaluate the expression, it is the end of their turn and the expression they chose is removed from the grid</li>
<li>If answer is correct, more points are awarded for turn if it was one of the highest value options available from the grid</li>
<li>If answer is incorrect, player loses a point for turn</li>
<li>Player 2 begins their turn</li>
<li>Once player 2 runs out of turns, the game is over and the player with the highest score wins!</li>
</ol>
</div>
<!-- Input and submit in modal -->
<div id="welcome-input-form-wrapper">
<form id="welcome-modal-form" autocomplete="off">
<div id="player-names-container">
<div class="player-name-wrapper">
<label for="player1Name">Player 1</label>
<input type="text" id="player1Name" name="player1Name" placeholder="Enter Name" size="10" title="player 1 name" aria-label="Enter player 1 name">
</div>
<div class="player-name-wrapper">
<label for="player2Name">Player 2</label>
<input type="text" id="player2Name" name="player2Name" placeholder="Enter Name" size="10" title="player 2 name" aria-label="Enter player 2 name">
</div>
</div>
<span>Choose difficulty level:</span>
<div class="choose-difficulty-wrapper">
<input type="radio" id="easier" name="difficultyLevel" value="easier" title="Easier difficulty" aria-label="Easier difficulty">
<label for="easier">Easier</label>
<input type="radio" id="harder" name="difficultyLevel" value="harder" title="Harder difficulty" aria-label="Harder difficulty">
<label for="harder">Harder</label>
</div>
<div id="start-game-button-wrapper">
<input id="start-game-button" type="submit" value="Start Game" title="Start game" aria-label="Click to start game">
</div>
<span id="welcome-modal-error-message1" title="Player name error" aria-label="player name error message"></span>
<span id="welcome-modal-error-message2" title="Choose a difficulty error" aria-label="difficulty error message"></span>
</form>
</div>
<!-- Footer section in modal -->
<footer class="section-wrapper modal-footer-wrapper">
<div class="modal-about-trigger-wrapper trigger-wrapper" title="View ABOUT section" aria-label="View ABOUT section content">
<span>ABOUT</span>
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-plus-square"></i>
</div>
<div class="section-wrapper modal-about-content-wrapper hide">
<div class="modal-dev-portfolio-wrapper">
<a href="https://thaysom22.github.io/portfolio_project/" target="_blank" aria-label="Click to open Thomas Haysom Developer Portfolio" title="Thomas Haysom - Developer Portfolio">
<i class="far fa-file" aria-hidden="true" title="Link to developer portfolio" aria-label="Link to developer portfolio"></i>
<span>thaysom22</span>
<span>Developer Portfolio</span>
</a>
</div>
<div class="modal-copyright-wrapper">
<span>For eductional purposes only</span>
<span>© Thomas Haysom 2020</span>
</div>
<div class="modal-github-repo-wrapper">
<a href="https://github.com/thaysom22/maths-substitution-game" target="_blank" aria-label="Click to open GitHub repo for this site" title="GitHub Repo: maths-substitution-game">
<i class="fab fa-github-square" aria-hidden="true" title="Link to GitHub repo for this site" aria-label="Link to GitHub repo for this site"></i>
<span>Code for this site</span>
<span>Suggestions welcome!</span>
</a>
</div>
</div>
</footer>
</div>
</div>
<!-- Gameover modal - open when document is loaded in browser -->
<div class="modal hide" id="gameover-modal" data-backdrop="static" data-keyboard="false" tabindex="-1" aria-label="gameover-modal" aria-hidden="true">
<div class="modal-content">
<!-- Main heading section within modal -->
<header class="modal-header-wrapper section-wrapper">
<h1 class="modal-main-heading heading">Substitution Skirmish!</h1>
</header>
<!-- Results section of gameover modal-->
<div id="final-results-wrapper" class="section-wrapper">
<div id="winner-result" class="player-result">
<h2 id="gameover-header" class="heading">GAME OVER!</h2>
<span></span>
</div>
<div id="player1-result" class="player-result">
<span class="name"></span>
<span class="score"></span>
</div>
<div id="player2-result" class="player-result">
<span class="name"></span>
<span class="score"></span>
</div>
</div>
<!-- Buttons section of gameover modal -->
<div id="gameover-buttons-wrapper" class="section-wrapper">
<button id="restart-game-button" class="gameover-button" title="restart game" aria-label="restart game">Restart</button>
<a href="." target="_self">
<div id="new-game-button" class="gameover-button" title="new game" aria-label="new game">New Game</div>
</a>
</div>
<!-- Footer section in modal -->
<footer class="section-wrapper modal-footer-wrapper">
<div class="modal-about-trigger-wrapper trigger-wrapper" title="View ABOUT section" aria-label="View ABOUT section content">
<span>ABOUT</span>
<!-- CREDIT: Font Awesome -->
<i aria-hidden="true" class="fas fa-plus-square"></i>
</div>
<div class="section-wrapper modal-about-content-wrapper hide">
<div class="modal-dev-portfolio-wrapper">
<a href="https://thaysom22.github.io/portfolio_project/" target="_blank" aria-label="Click to open Thomas Haysom Developer Portfolio" title="Thomas Haysom - Developer Portfolio">
<i class="far fa-file" aria-hidden="true" title="Click to open developer portfolio"></i>
<span>thaysom22</span>
<span>Developer Portfolio</span>
</a>
</div>
<div class="modal-copyright-wrapper">
<span>For eductional purposes only</span>
<span>© Thomas Haysom 2020</span>
</div>
<div class="modal-github-repo-wrapper">
<a href="https://github.com/thaysom22/maths-substitution-game" target="_blank" aria-label="Click to open GitHub repo for this site" title="GitHub Repo: maths-substitution-game">
<i class="fab fa-github-square" aria-hidden="true" title="Click to open GitHub repo for this site"></i>
<span>Code for this site</span>
<span>Suggestions welcome!</span>
</a>
</div>
</div>
</footer>
</div>
</div>
<!-- modal-backdrop layer for modals -->
<div id="modal-backdrop" class="modal-backdrop"></div>
</body>
</html>