Skip to content

Commit afbbffb

Browse files
authored
Merge pull request #19 from PThanushree/tp
Added Player vs Computer mode using Magic Square algorithm
2 parents 21cd952 + 4ce174f commit afbbffb

3 files changed

Lines changed: 272 additions & 158 deletions

File tree

index.html

Lines changed: 58 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,62 @@
11
<!DOCTYPE html>
22
<html lang="en">
3-
<head>
4-
<link
5-
rel="icon"
6-
href="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.ranklogos.com%2Fwp-content%2Fuploads%2F2016%2F09%2FTic-Tac-Toe-Logo-RK1219.png&f=1&nofb=1"
7-
/>
8-
<link rel="stylesheet" href="style.css" />
9-
<meta charset="UTF-8" />
10-
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
11-
<title>Tic-Tac-Toe</title>
12-
</head>
13-
<body>
14-
<h3 id="headline">Tic-Tac-Toe</h3>
15-
<h2 class="player_turn">Player 1 Turn</h2>
16-
<section>
17-
<div onclick="func(this)" class="box one"></div>
18-
<div onclick="func(this)" class="box two"></div>
19-
<div onclick="func(this)" class="box three"></div>
20-
<div onclick="func(this)" class="box four"></div>
21-
<div onclick="func(this)" class="box five"></div>
22-
<div onclick="func(this)" class="box six"></div>
23-
<div onclick="func(this)" class="box seven"></div>
24-
<div onclick="func(this)" class="box eight"></div>
25-
<div onclick="func(this)" class="box nine"></div>
26-
</section>
27-
<button onclick="restart(false)" id="btn">Restart</button>
3+
<head>
4+
<link
5+
rel="icon"
6+
href="https://external-content.duckduckgo.com/iu/?u=http%3A%2F%2Fwww.ranklogos.com%2Fwp-content%2Fuploads%2F2016%2F09%2FTic-Tac-Toe-Logo-RK1219.png&f=1&nofb=1"
7+
/>
8+
<link rel="stylesheet" href="style.css" />
9+
<meta charset="UTF-8" />
10+
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
11+
<title>Tic-Tac-Toe</title>
12+
</head>
13+
<body>
14+
<h3 id="headline">Tic-Tac-Toe</h3>
15+
<br />
2816

29-
<div id="overlay">
30-
<div id="overlay-display">
31-
<p id="result">Result</p>
32-
<button onclick="restart(true)" id="restart-btn">Restart</button>
33-
</div>
34-
</div>
35-
</body>
36-
<script src="index.js"></script>
17+
<!-- Mode selection -->
18+
<input
19+
type="radio"
20+
id="pvp"
21+
name="mode"
22+
value="pvp"
23+
checked
24+
onclick="mode='pvp'; restart(false)"
25+
/>
26+
<label for="pvp">Player vs Player</label>
27+
28+
<input
29+
type="radio"
30+
id="pvc"
31+
name="mode"
32+
value="pvc"
33+
onclick="mode='pvc'; restart(false)"
34+
/>
35+
<label for="pvc">Player vs Computer</label>
36+
37+
<h2 class="player_turn">Player 1 Turn</h2>
38+
<section id="board">
39+
<div onclick="func(this)" class="box one"></div>
40+
<div onclick="func(this)" class="box two"></div>
41+
<div onclick="func(this)" class="box three"></div>
42+
<div onclick="func(this)" class="box four"></div>
43+
<div onclick="func(this)" class="box five"></div>
44+
<div onclick="func(this)" class="box six"></div>
45+
<div onclick="func(this)" class="box seven"></div>
46+
<div onclick="func(this)" class="box eight"></div>
47+
<div onclick="func(this)" class="box nine"></div>
48+
</section>
49+
<!-- Main board restart button -->
50+
<button onclick="restart(false)" id="btn">Restart</button>
51+
52+
<!-- Popup overlay restart button -->
53+
<div id="overlay">
54+
<div id="overlay-display">
55+
<p id="result">Result</p>
56+
<button onclick="restart(true)" id="restart-btn">Restart</button>
57+
</div>
58+
</div>
59+
60+
</body>
61+
<script src="index.js"></script>
3762
</html>

0 commit comments

Comments
 (0)