Skip to content

Commit e742754

Browse files
committed
update
1 parent 12312c8 commit e742754

File tree

1 file changed

+24
-9
lines changed

1 file changed

+24
-9
lines changed

html/tic-tac-toe/index.html

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,13 @@
11
<html>
22
<head>
33
<title>Tic-Tac-Toe</title>
4+
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.0/css/bootstrap.min.css" integrity="sha384-9aIt2nRpC12Uk9gS9baDl411NQApFmC26EwAOH8WgZl5MYYxFfc+NcPb1dKGj7Sk" crossorigin="anonymous">
45
<style>
56
* {
6-
font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
7+
font-family: monospace;
8+
}
9+
body {
10+
margin: 10px;
711
}
812
.center {
913
text-align: center;
@@ -19,18 +23,26 @@
1923
width: 100px;
2024
height: 100px;
2125
padding: 15px;
26+
border: 1px solid black;
2227
}
2328
.restart-button {
2429
margin-bottom: 5px;
2530
}
2631
</style>
2732
</head>
2833
<body onload="init()">
29-
<div class="center">
30-
<h1>Tic-Tac-Toe!</h1>
31-
</div>
32-
<div class="center">
33-
<button id="restart-button" class="restart-button" onclick="restart()">restart</button>
34+
<div class="jumbotron jumbotron-fluid">
35+
<div class="container">
36+
<h1 class="display-4">Tic-Tac-Toe!</h1>
37+
<p class="lead">
38+
Classic Tic-Tac-Toe game; play against the computer
39+
</p>
40+
<hr class="my-4">
41+
<p>
42+
Hit restart at any time to start over
43+
</p>
44+
<button id="restart-button" type="button" class="btn btn-primary" onclick="restart()">restart</button>
45+
</div>
3446
</div>
3547
<table class="ttt-table">
3648
<tbody>
@@ -51,9 +63,8 @@ <h1>Tic-Tac-Toe!</h1>
5163
</tr>
5264
</tbody>
5365
</table>
54-
<div id="result" class="center">
55-
56-
</div>
66+
<br/>
67+
<div id="result" class="alert alert-primary" role="alert" style="display: none;"></div>
5768

5869
<audio id="clicked">
5970
<source src="audio/fairy.mp3" type="audio/mp3">
@@ -114,6 +125,7 @@ <h1>Tic-Tac-Toe!</h1>
114125
if (isGridFull()) {
115126
gameOver = true;
116127
result.innerHTML = `Draw!`;
128+
result.style.display = 'block';
117129
} else {
118130
function doTimer() {
119131
const position = getComputerPosition();
@@ -128,6 +140,7 @@ <h1>Tic-Tac-Toe!</h1>
128140
if (winner !== 'none') {
129141
gameOver = true;
130142
result.innerHTML = `${winner} Win!`;
143+
result.style.display = 'block';
131144
}
132145

133146
clearInterval(timer);
@@ -140,6 +153,7 @@ <h1>Tic-Tac-Toe!</h1>
140153
} else {
141154
gameOver = true;
142155
result.innerHTML = `${winner} Win!`;
156+
result.style.display = 'block';
143157
}
144158
}
145159

@@ -162,6 +176,7 @@ <h1>Tic-Tac-Toe!</h1>
162176
function restart() {
163177
const result = document.getElementById('result');
164178
result.innerHTML = '';
179+
result.style.display = 'none';
165180

166181
gameOver = false;
167182
clearTable();

0 commit comments

Comments
 (0)