-
Notifications
You must be signed in to change notification settings - Fork 9
/
wukong.html
158 lines (136 loc) · 6.91 KB
/
wukong.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
<!DOCTYPE HTML>
<html>
<head>
<!-- Encoding -->
<meta content="text/html;charset=utf-8" http-equiv="Content-Type">
<meta content="utf-8" http-equiv="encoding">
<!-- SEO -->
<meta name="description" content="javascript UCI chess engine - Wukong JS by Code Monkey King">
<meta name="keywords" content="UCI chess engine in javascript that runs in both browser and Arena GUI - Wukong JS by Code Monkey King">
<!-- Bootstrap -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<script src="js/jquery.min.js"></script>
<script src="js/bootstrap.bundle.min.js"></script>
<!-- Analytics -->
<script type="text/javascript">
$.post('https://maksimkorzh.pythonanywhere.com/analytics/api/post', {
date: new Date,
url: window.location.href
});
</script>
</head>
<body style="font-family:
monospace; font-size: 16px;
background: url(logo/wallpaper_wukong.jpg); background-repeat: no-repeat;
background-attachment: fixed;
background-position: center;
background-size: cover;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
"
class="img-fluid bg-cover text-center">
<div id="main">
<!-- Chess board view -->
<div id="chessboard"></div>
<div class="input-group mx-auto mt-1" style="width: 417px;">
<!-- Download PGN -->
<div class="input-group-append mb-1">
<button class="btn btn-outline-secondary text-dark bg-light mr-1" onclick="downloadPgn();">PGN</button>
</div>
<!-- FEN input -->
<input id="fen"
type="text"
class="form-control"
placeholder="FEN string"
value="r3k2r/p1ppqpb1/bn2pnp1/3PN3/1p2P3/2N2Q1p/PPPBBPPP/R3K2R w KQkq - 0 10"
/>
<!-- set FEN -->
<div class="input-group-append mb-1">
<button onclick="setFen();" class="btn btn-outline-secondary text-dark bg-light ml-1">FEN</button>
</div>
</div>
<!-- PGN -->
<textarea id="pgn" rows="3" name="text" class="form-control" style="width: 420px;"></textarea>
<div class="btn-group mt-1 mb-1" style="width: 420px;">
<!-- Bots -->
<div class="dropdown mr-1">
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<image id="current-bot-image" src="logo/talkchess_logo.png" style="width: 25px;"></img>
</button>
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton" style="width: 400px;">
<li class="list-group-item-action mb-1">
<img src="Images/baihua.jpg" class="ml-2" style="width: 40px; border: 1px solid #777;"></img>
<button class="btn col-9 text-left" onclick="setBot('Baihua');">Bai Hua (1000 Elo)</button>
</li>
<li class="list-group-item-action mb-1">
<img src="Images/DrPi.png" class="ml-2" style="width: 40px; border: 1px solid #777;"></img>
<button class="btn col-9 text-left" onclick="setBot('DrPi');">Dr Pi (1500 Elo)</button>
</li>
<li class="list-group-item-action mb-1">
<img src="Images/cmk.png" class="ml-2" style="width: 40px; border: 1px solid #777;"></img>
<button class="btn col-9 text-left" onclick="setBot('CMK');">Code Monkey King (1700 Elo)</button>
</li>
<li class="list-group-item-action">
<img src="logo/talkchess_logo.png" class="ml-2" style="width: 40px; border: 1px solid #777;"></img>
<button class="btn col-9 text-left" onclick="setBot('Wukong');">Song Wukong (1876 Elo)</button>
</li>
</div>
</div>
<!-- Game controls -->
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold mr-1" onclick="newGame();">New</button>
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold mr-1" onclick="userTime = 0; think();">Move</button>
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold mr-1" onclick="undo();">Undo</button>
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold" onclick="flip()">Flip</button>
<!-- Pawn promotin -->
<div class="dropdown ml-1">
<button class="btn btn-outline-secondary text-dark bg-light font-weight-bold dropdown-toggle" type="button" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
<image id="current-promoted-image" src="Images/5.gif" style="width: 25px;"></img>
</button>
<div class="dropdown-menu dropdown-menu-right text-right" aria-labelledby="dropdownMenuButton">
<li class="list-group-item-action mb-1" onclick="setPromotion(5);">
<button class="btn">Queen</button>
<img src="Images/5.gif" class="mr-2" style="width: 40px; border: 1px solid #777;"></img>
</li>
<li class="list-group-item-action mb-1" onclick="setPromotion(4);">
<button class="btn">Rook</button>
<img src="Images/4.gif" class="mr-2" style="width: 40px; border: 1px solid #777;"></img>
</li>
<li class="list-group-item-action mb-1" onclick="setPromotion(3);">
<button class="btn">Bishop</button>
<img src="Images/3.gif" class="mr-2" style="width: 40px; border: 1px solid #777;"></img>
</li>
<li class="list-group-item-action mb-1" onclick="setPromotion(2);">
<button class="btn">Knight</button>
<img src="Images/2.gif" class="mr-2" style="width: 40px; border: 1px solid #777;"></img>
</li>
</div>
</div>
</div>
<div>
<!-- Chess engine -->
<script src="wukong.js"></script>
<!-- Bots -->
<script src="js/bots.js"></script>
<!-- User input handling -->
<script src="js/play.js"></script>
<!-- DevTools detection -->
<script src="js/isdevtoolopen.js"> </script>
<!-- Remove background image when DevTools are open -->
<script type="module">
// on update page when devtools are opened
if (window.devtools.isOpen == 1) {
document.body.style.backgroundImage = '';
}
// on devtools open/close
window.addEventListener('devtoolschange', event => {
if (window.devtools.isOpen == 0) {
document.body.style.backgroundImage = '';
} else if (window.devtools.isOpen == 1) {
document.body.style.backgroundImage = 'url(logo/wallpaper_wukong.jpg)';
}
});
</script>
</body>
<html>