-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
148 lines (123 loc) · 4.55 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
<!DOCTYPE html>
<html>
<head>
<title>Dunsany's Chess</title>
<link rel="stylesheet" href="css/intro.css" />
<link rel="stylesheet" href="css/chessboard-1.0.0.css" />
</head>
<body>
<!-- board setup view-->
<div id="setup" style="text-align: center">
<h1>Dunsany's Chess</h1>
<h2>Select your character</h2>
<label>
<input type="radio" id="bin" value="wP2" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP2.png" />
</label>
<label>
<input type="radio" id="cleaner" value="wP0" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP0.png" />
</label>
<label>
<input type="radio" id="barista" value="wP1" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP1.png" />
</label>
<label>
<input type="radio" id="tdriver" value="wP7" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP7.png" />
</label>
<label>
<input type="radio" id="wworker" value="wP8" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP8.png" />
</label>
<label>
<input type="radio" id="nurse" value="wP6" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP6.png" />
</label>
<label>
<input type="radio" id="doctor" value="wP5" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP5.png" />
</label>
<label>
<input type="radio" id="street" value="wP3" name="character-select" />
<img class="character-select" src="img/chesspieces/wikipedia/wP3.png" />
</label>
<br /><br />
<h2>Select your difficulty</h2>
<label>
<input type="radio" id="veasy" value="1" name="difficulty" />
<img class="difficulty" src="img/difficulties/veasy.png" />
</label>
<label>
<input type="radio" id="easy" value="2" name="difficulty" />
<img class="difficulty" src="img/difficulties/easy.png" />
</label>
<label>
<input type="radio" id="normal" value="3" name="difficulty" />
<img class="difficulty" src="img/difficulties/normal.png" />
</label>
<label>
<input type="radio" id="hard" value="4" name="difficulty" />
<img class="difficulty" src="img/difficulties/hard.png" />
</label>
<label>
<input type="radio" id="vhard" value="5" name="difficulty" />
<img class="difficulty" src="img/difficulties/vhard.png" />
</label>
<br /><br /><br />
<button
id="go"
type="button"
disabled="disabled"
style="
height: 75px;
width: 200px;
font-size: 22pt;
"
onClick="startGame()"
>
Go
</button>
</div>
<!-- chessboard -->
<div id="board-container" style="display: none">
<div id="score" class="score">SCORE: 0</div>
<div id="high-score" class="score high-score">HIGH SCORE: 0</div>
<div id="board" style="width: 700px"></div>
<br />
<button onclick="window.location.reload()">Admit defeat</button>
<button onclick="showScoreScreen()">High scores</button>
<div id="difficulty-display" class="score high-score">
DIFFICULTY: Medium
</div>
</div>
<!-- game end screen -->
<div id="score-container" style="display: none">
<h1>Dunsany's Chess</h1>
<h1 id="win-status">YOU WIN</h1>
<h2 id="final-time">TIME: 3:02:0303</h2>
<h2 id="final-score">SCORE: 300</h2>
<button onclick="window.location.reload()">Play again</button>
</div>
<!-- scripts -->
<script src="https://chessboardjs.com/js/jquery-3.4.1.min.js"></script>
<script src="js/chessboard-1.0.0.js"></script>
<script src="chessmaster.js"></script>
<script src="chess-vs-ai.js"></script>
<script>
$(document).ready(function () {
var character = $("input[name=character-select]");
var difficulty = $("input[name=difficulty]");
validate();
$("input[type='radio']").change(validate);
function validate() {
if ($(character).is(":checked") && $(difficulty).is(":checked")) {
document.getElementById("go").disabled = false;
} else {
document.getElementById("go").disabled = true;
}
}
});
</script>
</body>
</html>