-
Notifications
You must be signed in to change notification settings - Fork 0
/
retractor.html
590 lines (555 loc) · 27 KB
/
retractor.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
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 //EN">
<html lang="en">
<head>
<title>Retractor 2</title>
<meta name="keywords" content="retrograde analysis, retros, chess problems, chess puzzles">
<meta name="description" content="Retrograde analysis chess problems software in Javascript">
<meta charset="UTF-8" content="Retractor 2">
<link rel="stylesheet" href="style.css">
</head>
<script type="text/javascript" src="constants.js"></script>
<script type="text/javascript" src="error.js"></script>
<script type="text/javascript" src="pseudoLegalityChecker.js"></script>
<script type="text/javascript" src="legalityChecker.js"></script>
<script type="text/javascript" src="cages.js"></script>
<script type="text/javascript" src="piece.js"></script>
<script type="text/javascript" src="board.js"></script>
<script type="text/javascript" src="boardGui.js"></script>
<script type="text/javascript" src="undo.js"></script>
<script type="text/javascript" src="stateChanges.js"></script>
<script type="text/javascript" src="pawnCaptures.js"></script>
<script type="text/javascript" src="solver.js"></script>
<script type="text/javascript" src="verifyCage.js"></script>
<body>
<div id="modalBackground" class="modal-background"></div>
<div class="flex-container">
<div class="left-inner-flex-container">
<div id="moveDiv">
<span>Mode</span>
<div>
<input type="radio" name="mode" id="modeEdit" value="edit"/>
<label for="modeEdit">Edit</label>
</div>
<div>
<input type="radio" name="mode" id="modePlay" value="play"/>
<label for="modePlay">Play</label>
</div>
<hr style="width:90%">
</div>
<div id="toRetractDiv">
<div id="retractHeading">Retract next</div>
<span id="retractColor"></span>
<div id="retractRadioButtons">
<div>
<input type="radio" name="toRetract" id="retractWhite" value="w"/>
<label for="retractWhite">White</label>
</div>
<div>
<input type="radio" name="toRetract" id="retractBlack" value="b"/>
<label for="retractBlack">Black</label>
</div>
</div>
<hr style="width:90%">
</div>
<div id="pieceCountDiv">
White <span id="whitePieceCount"></span><br>
Black <span id="blackPieceCount"></span><br>
<span id="moves">Moves <span id="moveCount"></span></span>
<hr style="width:90%">
</div>
<div id="pawnCapturesTable">
Captures
<table>
<tr>
<th></th>
<th>W</th>
<th>B</th>
<th>T</th>
</tr>
<tr>
<td>Pawn<sup><a href="javascript:openHelpPage('help_pawn_captures')">?</a></sup></td>
<td style="text-align:center" class="positionData" id="pawnCapturesWhite"></td>
<td style="text-align:center" class="positionData" id="pawnCapturesBlack"></td>
<td style="text-align:center" class="positionData" id="pawnCapturesTotal"></td>
</tr>
<tr>
<td>Total</td>
<td style="text-align:center" class="positionData" id="totalCapturesWhite"></td>
<td style="text-align:center" class="positionData" id="totalCapturesBlack"></td>
<td style="text-align:center" class="positionData" id="totalCapturesTotal"></td>
</tr>
</table>
<hr style="width:90%">
</div>
<div id="promoteeTable">
Promoted pieces
<table>
<tr>
<th></th>
<th>Q</th>
<th>R</th>
<th>B</th>
<th>N</th>
</tr>
<tr>
<td>W</td>
<td style="text-align:center" class="positionData" id="promoted_wQ"></td>
<td style="text-align:center" class="positionData" id="promoted_wR"></td>
<td style="text-align:center" class="positionData" id="promoted_wB"></td>
<td style="text-align:center" class="positionData" id="promoted_wN"></td>
</tr>
<tr>
<td>B</td>
<td style="text-align:center" class="positionData" id="promoted_bQ"></td>
<td style="text-align:center" class="positionData" id="promoted_bR"></td>
<td style="text-align:center" class="positionData" id="promoted_bB"></td>
<td style="text-align:center" class="positionData" id="promoted_bN"></td>
</tr>
</table>
</div>
<div id="configSection">
<input type="button" id="config" value="Config" onclick="showModal('configModal')">
</div>
</div>
<div class="center-flex-container">
<div class="board" id="board"></div>
<div id="setForsytheDiv">
<input id="forsytheText" type="text" placeholder="Forsythe notation" maxLength=80 size=45 value="">
<input id="setPositionButton" type="button" value="Set" onclick="setPosition()">
</div>
<div id="clearBoardGroup">
<input type="button" value="Clear board" onclick="clearBoardGui()">
<input type="button" value="Initial Position" onclick="setInitialPositionGui()">
</div>
<div id="controlGroup">
<input type="button" value="<<" onclick="undoAllGui()">
<input type="button" value="<" onclick="undoGui()">
<input type="button" value=">" onclick="redoGui()">
<input type="button" value=">>" onclick="redoAllGui()">
<input type="button" id="solve" value="Solve">
<input type="button" id="copyGame" value="Copy" onclick="copyGameGui()">
<input type="button" id="pasteGame" value="Paste" onclick="showModal('pasteGameModal')">
<input type="button" id="verifyCage" value="Cage" onclick="verifyCageGui()">
</div>
<div id="errorMessage" style="color:#FF0000; flex-grow: 0"></div>
<div id="solveModal" class="modal-content">
<span id="solveClose" class="close">×</span>
<div class="modal-body">
<label for="solveDepth">Solve depth:</label>
<input id="solveDepth" type="number" min="1" max="100" size="3" value="1">
<br>
<label for="extraDepth">Extra depth:</label>
<input id="extraDepth" type="number" min="0" max="100" size="3" value="3">
<br>
<label for="maxSolutions">Max solutions:</label>
<input id="maxSolutions" type="number" min="1" max="10000" size="5" value="5">
<br>
<label for="noWhiteUncaptures">No white uncaptures</label>
<input type="checkbox" id="noWhiteUncaptures" />
<br>
<label for="noBlackUncaptures">No black uncaptures</label>
<input type="checkbox" id="noBlackUncaptures" />
<br>
<div id="solveErrorMessage" style="color:#FF0000"></div>
<br>
<input id="startSolve" type="button" value="Solve" onclick="solveGui()">
</div>
</div>
<div id="configModal" class="modal-content">
<span id="configClose" class="close">×</span>
<div class="modal-body">
<label for="promotionSearchThreshold">Promotion search threshold:</label>
<input id="promotionSearchThreshold" type="number" min="1" max="1000000" size="6" value="1000">
<br>
<label for="separateCaptureTracking">Separate capture tracking</label>
<input type="checkbox" id="separateCaptureTracking" />
<br>
<input id="configOk" type="button" value="Ok">
<input id="configCancel" type="button" value="Cancel" onclick="clearModal('configModal')">
</div>
</div>
<div id="illegalPositionModal" class="modal-content">
<span id="illegalPositionClose" class="close">×</span>
<div id="illegalPositionErrorMessage" style="color:#FF0000"></div>
<input type="button" id="illegalPositionUndo" value="Go back">
<input type="button" id="illegalPositionContinue" value="Continue anyway">
<input type="button" id="illegalPositionCage" value="Cage">
</div>
<div id="pasteGameModal" class="modal-content">
<span id="pasteGameClose" class="close">×</span>
<label for="pasteGameInput">Paste game here</label><br>
<textarea id="pasteGameInput" cols=40 rows=5></textarea>
<input type="button" id="reallyPasteGame" value="Paste">
</div>
<div id="copyGameModal" class="modal-content">
<span id="copyGameClose" class="close">×</span>
<label for="copyGameText">Copy game from here</label><br>
<textarea id="copyGameText" cols=40 rows=5 readonly></textarea>
</div>
<div id="verifyCageModal" class="modal-content">
<span id="verifyCageClose" class="close">×</span>
<div class="modal-body">
<div id="verifyCageMessage"></div>
<br>
<input type="button" id="verifyCageSelectAll" value="Select All">
<input type="button" id="verifyCageUnselectAll" value="Unselect All">
<input type="button" id="verifyCageVerify" value="Verify">
<input type="button" id="verifyCageTryAnother" value="Try another cage">
<input type="button" id="verifyCageImport" value="Import">
<input type="button" id="verifyCageExport" value="Export">
<input type="file" id="verifyCageImportFile" style="visibility: hidden">
</div>
</div>
</div>
<div class="right-inner-flex-container">
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_wQ" value="Q"/>
<label for="pieceSelection_wQ"><img alt="white queen" src="images/Chess_qll44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_wR" value="R"/>
<label for="pieceSelection_wR"><img alt="white rook" src="images/Chess_rll44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_wB" value="B"/>
<label for="pieceSelection_wB"><img alt="white bishop" src="images/Chess_bll44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_wN" value="N"/>
<label for="pieceSelection_wN"><img alt="white knight" src="images/Chess_nll44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_wP" value="P"/>
<label for="pieceSelection_wP"><img alt="white pawn" src="images/Chess_pll44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_none" value=""/>
<label for="pieceSelection_none">None</label>
</div>
<div id="ep_and_unpromote">
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_ep" value="ep"/>
<label for="pieceSelection_ep">e.p.</label>
</div>
<hr style="width:90%">
<div>
<input type="checkbox" name="unpromote" id="unpromoteSelection" onclick="toggleUnpromote()"/>
<label for="unpromoteSelection">Unpromote</label>
</div>
</div>
</div>
<div id="black_pieces" class="right-inner-flex-container">
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_bQ" value="q"/>
<label for="pieceSelection_bQ"><img alt="black queen" src="images/Chess_qdl44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_bR" value="r"/>
<label for="pieceSelection_bR"><img alt="black rook" src="images/Chess_rdl44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_bB" value="b"/>
<label for="pieceSelection_bB"><img alt="black bishop" src="images/Chess_bdl44.png"/></label>
</div
><div>
<input type="radio" name="pieceSelection" id="pieceSelection_bN" value="n"/>
<label for="pieceSelection_bN"><img alt="black knight" src="images/Chess_ndl44.png"/></label>
</div>
<div>
<input type="radio" name="pieceSelection" id="pieceSelection_bP" value="p"/>
<label for="pieceSelection_bP"><img alt="black pawn" src="images/Chess_pdl44.png"/></label>
</div>
</div>
<div id="solutions" class="solution-flex-container">
<div id="positionDataDisplay"></div>
Solutions will appear here
<span id="exportSolutionsSpan" style="visibility: hidden">
<label for="exportSolutionsFilename">Export filename:</label>
<input id="exportSolutionsFilename" type="text">
<input type="button" id="exportSolutions" value="Export Solutions">
</span>
<div id="solutionDisplay"></div>
</div>
</div>
<div class="helpSection" id="help">
</div>
<script type="text/javascript">
let currentPage;
function openHelpPage(page) {
const newPage = document.getElementById(page);
if (newPage) {
if (currentPage) {
document.getElementById(currentPage).style.display = "none";
}
currentPage = page;
document.getElementById(currentPage).style.display = "block";
}
}
fetch("help.html").then(response => response.text()).then(text => {
document.getElementById("help").innerHTML = text;
openHelpPage("help_front");
const allHelpPages = document.getElementsByClassName("helpPage");
Array.prototype.forEach.call(allHelpPages, helpPage => {
if (helpPage.id != "help_front" && !helpPage.id.startsWith("help_tutorial")) {
helpPage.innerHTML += "<a href=\"javascript:openHelpPage('help_front')\">Back to front page</a>";
} else if (helpPage.id.startsWith("help_tutorial")) {
const pageNumber = parseInt(helpPage.id.split("_")[2]);
let prevPage;
let nextPage;
if (pageNumber == 1) {
prevPage = "help_front";
} else {
prevPage = "help_tutorial_" + (pageNumber - 1);
}
nextPage = "help_tutorial_" + (pageNumber + 1);
const nextPageElement = document.getElementById(nextPage);
let navigationText =
"<a href=\"javascript:openHelpPage('" + prevPage + "')\">Previous page</a>";
if (nextPageElement != null) {
navigationText += " <a href=\"javascript:openHelpPage('" + nextPage + "')\">Next page</a>";
}
navigationText += " <a href=\"javascript:openHelpPage('help_front')\">Back to front page</a>";
helpPage.innerHTML = navigationText + "<br>" + helpPage.innerHTML + "<br><br>" + navigationText;
}
});
});
function openTutorialPosition(forsythe, toRetract, playMoves) {
switchToEditMode(true);
setForsythe(forsythe);
setRetract(toRetract);
switchToPlayMode();
if (playMoves != null) {
const [numMoves, illegalMove] = replayGame(playMoves);
assert(illegalMove == null, 'Illegal move ' + illegalMove + ' in tutorial position ' + forsythe);
for (let i = 0; i < numMoves; i++) redo();
updateVisualBoard();
}
}
document.getElementsByName("pieceSelection").forEach(
element => {
element.onclick = setUncapturedPiece;
}
)
document.getElementsByName("mode").forEach(
element => {
element.onclick = setMode;
}
)
document.getElementsByName("toRetract").forEach(
element => {
element.onclick = setRetractGui;
}
)
// some browsers will insert the filename of the image if you drag the image
// into a text input element. Disable this.
document.getElementById("forsytheText").ondragenter = function() { return false; }
document.getElementById("forsytheText").ondragover = function() { return false; }
document.getElementById("forsytheText").ondrop = function() { return false; }
// disable dragging of any image other than those on the chessboard
document.ondragstart = function(event) {
if (event.target.className != "cell") {
return false;
}
}
// Setup modals
const modalBackground = document.getElementById("modalBackground");
// Setup config modal
const configButton = document.getElementById("config");
const configModal = document.getElementById("configModal");
const configCloseSpan = document.getElementById("configClose");
const configOk = document.getElementById("configOk");
const configPromotionSearchThreshold = document.getElementById("promotionSearchThreshold");
const configSeparateCaptureTracking = document.getElementById("separateCaptureTracking");
configButton.onclick = function() {
configPromotionSearchThreshold.value = getPromotionSearchThreshold();
configSeparateCaptureTracking.checked = getEnableSeparateCaptureTracking();
showModal("configModal");
}
configCloseSpan.onclick = function() {
clearModal("configModal");
}
configOk.onclick = function() {
setPromotionSearchThreshold(parseInt(configPromotionSearchThreshold.value, 10));
setEnableSeparateCaptureTracking(configSeparateCaptureTracking.checked);
getPawnCaptureCache().clear();
clearModal("configModal");
}
// Setup solve modal
const solveModal = document.getElementById("solveModal");
const solveButton = document.getElementById("solve");
const solveCloseSpan = document.getElementById("solveClose");
solveButton.onclick = function() {
showModal("solveModal");
}
solveCloseSpan.onclick = function() {
resetSolver();
}
// Setup illegal position modal
const illegalPositionModal = document.getElementById("illegalPositionModal");
const illegalPositionUndo = function() {
if (!undoGui(true)) { // if we can't undo, then we need to switch back to edit mode
switchToEditMode(false); // don't clear flags since we haven't played any moves
}
clearModal("illegalPositionModal");
updateVisualBoard();
}
document.getElementById("illegalPositionClose").onclick = illegalPositionUndo;
document.getElementById("illegalPositionUndo").onclick = illegalPositionUndo;
document.getElementById("illegalPositionContinue").onclick = function() {
clearModal("illegalPositionModal");
showError("Continuing on illegal position.");
}
document.getElementById("illegalPositionCage").onclick = function() {
clearModal("illegalPositionModal");
updateVisualBoard();
verifyCageGui();
}
// Setup paste game modal
const pasteGameModal = document.getElementById("pasteGameModal");
document.getElementById("pasteGameClose").onclick = function() { clearModal("pasteGameModal"); }
document.getElementById("reallyPasteGame").onclick = function() {
processMoveText(document.getElementById("pasteGameInput").value);
clearModal("pasteGameModal");
}
// Setup copy game modal
const copyGameModal = document.getElementById("copyGameModal");
document.getElementById("copyGameClose").onclick = function() { clearModal("copyGameModal"); }
// Setup verify cage modal
const verifyCageModal = document.getElementById("verifyCageModal");
const verifyCageUndo = function() {
verifyCageSelectionMode = false;
verifyCageSelectedSquares = [];
clearModal('verifyCageModal');
document.getElementById("verifyCageVerify").value = 'Verify';
document.getElementById("board").style.zIndex = 'auto';
updateVisualBoard();
}
document.getElementById("verifyCageClose").onclick = verifyCageUndo;
document.getElementById("verifyCageSelectAll").onclick = function() {
verifyCageSelectedSquares = [];
for (let file = 0; file < 8; file++) {
for (let rank = 0; rank < 8; rank++) {
if (!isEmpty(board[file][rank])) {
verifyCageSelectedSquares.push(new Square(file, rank));
document.getElementById(file + ":" + rank).style.opacity = 0.5;
}
}
}
}
document.getElementById("verifyCageUnselectAll").onclick = function() {
verifyCageSelectedSquares.forEach(selectedSquare => {
document.getElementById(selectedSquare.mFile + ":" + selectedSquare.mRank).style.opacity = 1.0;
});
verifyCageSelectedSquares = [];
}
document.getElementById("verifyCageVerify").onclick = function() {
if (!verifyCageSelectionMode) { // verification process complete
verifyCageUndo();
return;
}
document.getElementById("verifyCageSelectAll").style.visibility = "hidden";
document.getElementById("verifyCageUnselectAll").style.visibility = "hidden";
document.getElementById("verifyCageImport").style.visibility = "hidden";
document.getElementById("verifyCageExport").style.visibility = "hidden";
document.getElementById("board").style.zIndex = 'auto';
verifyCageSelectionMode = false;
const cageVerificationResult = verifyCage(null, verifyCageSelectedSquares, true);
if (cageVerificationResult.isCageVerified) {
document.getElementById("verifyCageMessage").innerHTML = "The cage has been verified and saved.";
} else {
document.getElementById("verifyCageMessage").innerHTML =
"The cage could NOT be verified. Possible retraction sequence: <br>" +
cageVerificationResult.retractionSequence.map(moveToString).join(" ");
}
document.getElementById("verifyCageVerify").value = 'OK';
document.getElementById("verifyCageTryAnother").style.visibility = "visible";
}
document.getElementById("verifyCageTryAnother").onclick = verifyCageGui;
document.getElementById("verifyCageImport").onclick = function() {
document.getElementById("verifyCageImportFile").click();
}
document.getElementById("verifyCageImportFile").addEventListener('change', function() {
const selectedFiles = document.getElementById("verifyCageImportFile").files;
if (selectedFiles.length > 0) {
const selectedFile = selectedFiles[0];
selectedFile.text().then(importCages).then(result => {
if (result.length == 1) { // some line has invalid forsythe notation
verifyCageUndo();
const lineNumber = result[0];
showError("No cages imported. Imported file has invalid Forsythe notation on line " + lineNumber.toString());
} else {
[badLineNumbers, successfulImportCount, duplicates] = result;
verifyCageUndo();
let message = "";
if (badLineNumbers.length > 0) {
message += "Could not verify cages on lines: " + badLineNumbers.join(",") + ". ";
}
message += "Imported " + successfulImportCount + " cages. ";
if (duplicates > 0) {
message += "Ignored " + duplicates + " duplicate cages.";
}
showError(message);
}
});
}
});
const fakeDownload = document.createElement('a');
fakeDownload.style.display = 'none';
document.getElementById("verifyCageExport").onclick = function() {
const data = new Blob([serializedRequestedCages.join("\n")]);
const currentTimeIsoString = new Date(Date.now()).toISOString();
const filenameSuffix = currentTimeIsoString.slice(0, -5).replaceAll(/[:-]/g, "");
const filename = "retractor_cages_" + filenameSuffix + ".txt";
download(data, filename);
verifyCageUndo();
}
document.getElementById("exportSolutions").onclick = function() {
const exportedSolutions = exportSolutions();
if (exportedSolutions == null) {
return;
}
const data = new Blob([exportedSolutions.join("\n")]);
let filename = document.getElementById("exportSolutionsFilename").value;
if (!filename) {
const currentTimeIsoString = new Date(Date.now()).toISOString();
const filenameSuffix = currentTimeIsoString.slice(0, -5).replaceAll(/[:-]/g, "");
filename = "exported_solutions_" + filenameSuffix + ".txt";
}
download(data, filename);
}
// Take the "close" action if clicking on the outside for certain modals
window.onclick = function(event) {
if (event.target == document.getElementById("modalBackground")) {
if (illegalPositionModal.style.display != "none" && illegalPositionModal.style.display != "") {
illegalPositionUndo();
} else if (pasteGameModal.style.display != "none" && pasteGameModal.style.display != "") {
clearModal("pasteGameModal");
} else if (copyGameModal.style.display != "none" && copyGameModal.style.display != "") {
clearModal("copyGameModal");
} else if (verifyCageModal.style.display != "none" && verifyCageModal.style.display != "" && !verifyCageSelectionMode) {
verifyCageUndo();
} else if (configModal.style.display != "none" && configModal.style.display != "") {
clearModal("configModal");
}
}
}
// "Show" and "Clear" functions for each modal
function showModal(modalId) {
modalBackground.style.display = "block";
document.getElementById(modalId).style.display = "block";
}
function clearModal(modalId) {
modalBackground.style.display = "none";
document.getElementById(modalId).style.display = "none";
}
initializeBoardGui();
currentUncapturedUnit = "";
verifyCageSelectionMode = false;
verifyCageSelectedSquares = [];
/* Gerald Ettl, Die Schwalbe Heft 157, Feb 1996, Problem 9129 - Last 30 single moves? */
setForsythe('nBb2R1R/bqr5/kppp4/n3K2B/p1P1ppNN/rP2PPpp/P2P1QPP/8');
setRetract("b");
switchToPlayMode();
</script>
</body>
</html>