-
Notifications
You must be signed in to change notification settings - Fork 1
/
chess.html
241 lines (209 loc) · 13.1 KB
/
chess.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
<!DOCTYPE html>
<html lang="en">
<head>
<title>Maya Chess</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta
name="description"
content="A simple chess AI.">
<!-- Bootstrap CSS -->
<link rel="stylesheet"
href="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css"
integrity="sha384-Vkoo8x4CGsO3+Hhxv8T/Q5PaXtkKtu6ug5TOeNV6gBiFeWPGFN9MuhOf23Q9Ifjh"
crossorigin="anonymous">
<!-- Custom CSS -->
<link rel="stylesheet" href="css/main.css">
<!-- Google Icons (Material Design) -->
<link rel="stylesheet"
href="https://fonts.googleapis.com/icon?family=Material+Icons"
crossorigin="anonymous">
<!-- Font Awesome -->
<script src="https://kit.fontawesome.com/5b14db5f0b.js" crossorigin="anonymous"></script>
<!-- jQuery -->
<script
src="https://code.jquery.com/jquery-3.5.1.js"
integrity="sha256-QWo7LDvxbWT2tbbQ97B53yJnYU3WhH/C8ycbRAkjPDc="
crossorigin="anonymous">
</script>
<!-- Chessboard JS -->
<link rel="stylesheet"
href="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.css"
integrity="sha384-q94+BZtLrkL1/ohfjR8c6L+A6qzNH9R2hBLwyoAfu3i/WCvQjzL2RQJ3uNHDISdU"
crossorigin="anonymous">
<script defer src="https://unpkg.com/@chrisoakman/chessboardjs@1.0.0/dist/chessboard-1.0.0.min.js"
integrity="sha384-8Vi8VHwn3vjQ9eUHUxex3JSN/NFqUg3QbPyX8kWyb93+8AC/pPWTzj+nHtbC5bxD"
crossorigin="anonymous"></script>
<!-- Chess JS (slightly modified) -->
<script defer src="js/chess.js"></script>
</script>
<!-- Bootstrap JS -->
<script defer
src="https://stackpath.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.bundle.min.js"
integrity="sha384-6khuMg9gaYr5AxOqhkVIODVIvm9ynTT5J4V1cfthmT+emCG6yVmEZsRHdxlotUnm"
crossorigin="anonymous">
</script>
<!-- Custom JS -->
<script defer src="js/main.js"></script>
</head>
<body style="background-color:#2c2c24;">
<br>
<main>
<div class="container my-3">
<div class="row align-items-center">
<br>
<div class="col-md-6">
<div id="myBoard"></div>
<div class="row my-3 text-align-center">
<div class="col sm">
<button class="btn btn-light" id="undoBtn">Undo</button>
</div>
<div class="col sm">
<button class="btn btn-light" id="redoBtn">Redo</button>
</div>
<div class="col sm">
<button class="btn btn-warning" id="resetBtn">New Game</button>
</div>
</div>
</div>
<div class="col-md-6">
<h1 class="text-align-center">Maya Chess AI</h1>
<p class="text-align-center"> An Engine to boost your ego <3 </p>
<div class="row justify-content-center">
<span id="position-count">0</span>   positions evaluated in   <span id="time">0</span>s.
</div>
<div class="row mb-3 justify-content-center">
That's   <span id="positions-per-s">0</span>   positions/s.
</div>
<div id="accordion">
<div class="card">
<div class="card-header" id="settingsHeading">
<h2 class="text-align-center">
<button class="btn btn-header no-outline" data-toggle="collapse" data-target="#settings" aria-expanded="true" aria-controls="settings">
Settings
</button>
</h2>
</div>
</div>
<div id="settings" class="collapse" aria-labelledby="settingsHeading" data-parent="#accordion">
<div class="card-body">
<div class="row align-items-center justify-content-center">
<div class="form-group">
<label for="search-depth">Search Depth (Black):</label>
<select id="search-depth">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
</select>
</div>
</div>
<div class="row align-items-center justify-content-center">
<div class="form-group">
<label for="search-depth-white">Search Depth (White):</label>
<select id="search-depth-white">
<option value="1">1</option>
<option value="2">2</option>
<option value="3" selected>3</option>
<option value="4">4</option>
</select>
</div>
</div>
<div class="row align-items-center justify-content-center">
<div class="form-group">
<input type="checkbox" id="showHint" name="showHint" value="showHint">
<label for="showHint">Show Suggested Move (White)</label>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="openingPositionsHeading">
<h2 class="text-align-center">
<button class="btn btn-header no-outline" data-toggle="collapse" data-target="#openingPositions" aria-expanded="true" aria-controls="openingPositions">
Opening Positions
</button>
</h2>
</div>
</div>
<div id="openingPositions" class="collapse" aria-labelledby="openingPositionsHeading" data-parent="#accordion">
<div class="card-body">
<div class="row my-3 text-align-center">
<div class="col-md-6 my-2">
<label for="select"><h4>Choose an Opening </h4></label>
</div>
<div class="col-md-6 my-2">
<select class="btn btn-primary" style="width: 230px;" id="select" onmousedown="this.value='';" onchange="SelectGame(this.value);" onfocus="this.size=10">
<option value="none" selected>Choose</option>
<option value="sicillain" >Sicillian Defence</option>
<option value="monkey">Monkeys Bum</option>
<option value="nes">Nescafé Frappe Attack</option>
<option value="bong">Bong Cloud</option>
<option value="toilet">The Toilet Variation</option>
<option value="carokann">Caro Kann</option>
<option value="queenaccept">Queen's Gambit Accepted</option>
<option value="french">French Defence</option>
<option value="ruy">Ruy Lopez</option>
<option value="italian">The Italian Game</option>
<option value="scand">Scandinavian Defence</option>
<option value="kingsgambit">The King's Gambit</option>
<option value="vienna">Vienna</option>
<option value="scotch">Scotch Game</option>
<option value="alekhine">Alekhine Defense</option>
<option value="pirc">Pirc Defence</option>
<option value="slav">Slav Defence</option>
</select>
</div>
</div>
</div>
</div>
<div class="card">
<div class="card-header" id="compVsCompHeading">
<h2 class="text-align-center">
<button class="btn btn-header no-outline" data-toggle="collapse" data-target="#compVsComp" aria-expanded="true" aria-controls="compVsComp">
Computer vs. Computer
</button>
</h2>
</div>
</div>
</div>
<div id="compVsComp" class="collapse" aria-labelledby="compVsCompHeading" data-parent="#accordion">
<div class="card-body">
<div class="row text-align-center">
<div class="col-md-6 my-2">
<button class="btn btn-success" id="compVsCompBtn">Start Game</button>
</div>
<div class="col-md-6 my-2">
<button class="btn btn-danger" id="resetBtn">Stop and Reset</button>
</div>
</div>
</div>
</div>
<div class="row my-3 text-align-center">
<div class="col-md-12">
<h2>Advantage</h2>
<p><span id="advantageColor">Neither side</span> has the advantage
</p>
<div class="progress">
<div class="progress-bar bg-primary progress-bar-striped progress-bar-animated"
role="progressbar" aria-valuenow="0" style="width: 50%"
aria-valuemin="-2000" aria-valuemax="4000" id='advantageBar'>
</div>
</div>
</div>
</div>
<div class="row my-3 text-align-center">
<div class="col-md-12">
<h2>Status</h2>
<p><span id="status">No check, checkmate, or draw.</span></p>
</div>
</div>
</div>
<div class="col">
<h2 id="heading">Pro Tips #1:</h2>
<p><span id="rant">Why play a good move when you can blunder instead?</span></p>
</div>
</div>
</div>
</main>
</body>
</html>