-
Notifications
You must be signed in to change notification settings - Fork 0
/
games.html
209 lines (171 loc) · 8.91 KB
/
games.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
<!DOCTYPE html>
<html lang="en" id = "html"></html>
<script src = "JavaScript/jquery-3.4.1.js"></script>
<script>
$(function(){
$("header").load("header.html");
$("head").load("head.html");
$("footer").load("footer.html");
});
</script>
<head>
</head>
<div id="modal" class="modal">
<div class="modal-content">
<!-- <span class="close">×</span> -->
<div id="modal-content"></div>
</div>
</div>
<div id="alert" class="alert modal">
<div class="alert-content">
<span class="close-alert">×</span>
<div id="alert-content"></div>
</div>
</div>
<body hidden>
<header></header>
<script>
const pixleRatio = window.devicePixelRatio || 1
var boxWidthRatio
if (window.matchMedia('(max-width: 1300px)').matches) {
boxWidth = 44
boxWidthRatio = Math.ceil(44 * 1.5)//* scale;
} else {
boxWidth = 44;
boxWidthRatio = Math.ceil(44 * 1.5 * pixleRatio)//* scale;
//console.log(Math.ceil(44 * 1.5 * pixleRatio), (44 * 1.5 * pixleRatio))
}
boxWidthRatio = Math.round(boxWidthRatio / 2) * 2;
const alertModal = document.getElementById('alert');
const alertMessage = document.getElementById('alert-content');
const closeAlert = document.querySelector('.close-alert');
closeAlert.addEventListener('click', function() {
alertModal.style.display = 'none';
});
window.addEventListener('click', function(event) {
if (event.target == alertModal) {
alertModal.style.display = 'none';
}
});
</script>
<div id = "content" >
<div id = "top">
<h1 class="header">Games </h1>
<br>
</div>
</div>
<main class= "gameHolder" >
<section class="sectionContainer">
<div class = "textHolder" >
<h3>1. MineSweeper </h3>
<strong>Instructions:</strong> The objective of Minesweeper is to clear a rectangular board containing hidden "mines" or bombs without detonating any of them, with help from clues about the number of neighboring mines in each cell.
The board is divided into cells, which can either be blank or contain a number indicating the number of mines in adjacent cells (including diagonals). To win the game, you must flag all the mines and reveal all the other cells. You lose the game if you reveal a cell containing a mine.
To reveal a cell, simply click on it. If the cell does not contain a mine, it will reveal the number of adjacent mines, or be blank if there are no adjacent mines. If the cell does contain a mine, the game is over and you lose.
To flag a cell as containing a mine, right-click on it. If you flag all the mines and reveal all the other cells, you win. Selecting "Easy", "Medium", "Hard" or "Expert" will reset the game and generate 20, 50, 80 or 120
bombs. <br><br> In additon to the game, there is an AI solver which uses various algorithms and techniques to analyze the Minesweeper board and make educated guesses about which cells contain mines. You can active the AI solver by pressing the solve button at the top right
</div>
<div id="minesweeperHolder">
<script src = "Submodules/Minesweeper/Scripts/minesweeper.js"> </script>
</div>
</section>
<section class="sectionContainer">
<div class="textHolder">
<h3>2. Snakes</h3>
<strong>Instructions:</strong> The goal of this game is to grow the snake as long as possible. Inorder to grow, the snake needs to consume food. If the snake
runs into the walls or its own self the game is over. Click 'reset' before starting a new game.
</div>
<div id = "snakeContainer" class="game">
<div id="SnakesTitle">Snakes</div>
<div id="SnakesScore">0</div>
<button id="resetSnake">Reset</button>
<br>
<canvas id="snake"> </canvas>
<script src = "JavaScript/snakes.js"></script>
</div>
</section>
<section class="sectionContainer">
<div class="textHolder">
<h3>3. Flappy Bird</h3>
<strong>Instructions:</strong> Try to get as far as possible. Press play to start and any key to jump.
</div>
<div id = "flappybirdContainer" class="game">
<button id = "startFlappyBird"></button>
<button id = "leaderboardsFlappyBird" hidden></button>
<table id = "leaderboardTable" class="flappyBirdCanvas" hidden></table>
<canvas id = "background" class="flappyBirdCanvas" height = "600px" width = "600px"
style="z-index: 0;"></canvas>
<canvas id = "pipes" class="flappyBirdCanvas" height = "600px" width = "600px"
style="z-index: 1;"></canvas>
<canvas id = "bird" class="flappyBirdCanvas" height = "600px" width = "600px"
style="z-index: 2;"></canvas>
<canvas id = "gameOver" class="flappyBirdCanvas" height = "600px" width = "600px"
style="z-index: 3;"></canvas>
<script src = "JavaScript/flappyBird.js"></script>
</div>
</section>
<section class="sectionContainer">
<div class="textHolder">
<h3>4. Tetris</h3>
<strong>Description: </strong>
The objective of Tetris is to place as many pieces as possible.
The pieces will start at the top of the screen and drop down towards the bottom.
The pieces can be moved left, right, down or rotated.
Additionally, the current piece can be swapped with the piece in the hold box.
When a row is completely full the row will be cleared, and all tiles above will be moved down one row.
If a new piece can not be placed without hitting an already placed object, the game is over.
<br><br>
'A' and 'S' to move. W to rotate. Space to swap. Enter to fast drop.
</div>
<div id = "tetrisContainer" style="margin:auto" class="game">
<br>
<button class = "tetrisButton" id="tetrisStart">Start Game</button>
<button class = "tetrisButton" id="tetrisAIStart">Start AI</button>
<canvas id="tetris" > </canvas>
<script src = "Submodules/Tetris/Scripts/tetris/aiTetris.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetrisBox.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetrisObject.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetrisGameBoard.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetrisCanvas.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetris.js"></script>
<script src = "Submodules/Tetris/Scripts/tetris/tetrisControler.js"></script>
</div>
</section>
</main>
<footer></footer>
</body>
<script>
function link(){
const modal = document.getElementById('modal');
const closeButtons = document.querySelector('.close');
closeButtons.addEventListener('click', function() {
modal.style.display = 'none';
});
}
window.addEventListener("load", link);
$(function(){
$("#games").before()
});
// let tetrisCanvas = document.getElementById("tetris");
// tetrisCanvas.style.maxHeight = "1050px"
let snakeCanvas = document.getElementById("snake");
snakeCanvas.style.maxHeight = "1050px"
let flappyBackgroundCanvas = document.getElementById("background");
flappyBackgroundCanvas.style.maxHeight = "1050px"
let flappyPipesCanvas = document.getElementById("pipes");
flappyPipesCanvas.style.maxHeight = "1050px"
let flappyBirdCanvas = document.getElementById("bird");
flappyBirdCanvas.style.maxHeight = "1050px"
let flappyGameOverCanvas = document.getElementById("gameOver");
flappyGameOverCanvas.style.maxHeight = "1050px"
const tetrisCanvas = document.getElementById("tetris");
function resizeGame(){
let avalibleWidth = window.innerWidth
let avalibleHeight = Math.min(window.innerHeight, avalibleWidth * 1.04) ;
tetrisCanvas.style.height = (avalibleHeight * .90) +"px"
tetrisCanvas.style.maxHeight = (avalibleHeight * .90) +"px"
resizeButtons()
}
window.addEventListener("load", resizeGame);
window.addEventListener("resize", resizeGame);
</script>
</html>