api-ix commited on
Commit
56c6e87
Β·
verified Β·
1 Parent(s): 19b540a

Update index.html

Browse files
Files changed (1) hide show
  1. index.html +41 -26
index.html CHANGED
@@ -3,7 +3,7 @@
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Arcane Chess Analyzer</title>
7
 
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.css">
9
 
@@ -12,7 +12,7 @@
12
  --bg-color: #212121;
13
  --text-color: #e0e0e0;
14
  --accent-color: #4caf50;
15
- --highlight: #00e5ff; /* Cyan for Best Move */
16
  --panel-bg: #333;
17
  }
18
 
@@ -28,7 +28,7 @@
28
  user-select: none;
29
  }
30
 
31
- h1 { margin-bottom: 15px; text-align: center; font-size: 1.5rem; }
32
 
33
  .container {
34
  display: flex;
@@ -54,7 +54,7 @@
54
  color: #777;
55
  }
56
 
57
- /* --- HIGHLIGHT CLASS (Applied by JS) --- */
58
  .highlight-best {
59
  box-shadow: inset 0 0 3px 3px var(--highlight) !important;
60
  background-color: rgba(0, 229, 255, 0.3) !important;
@@ -73,7 +73,7 @@
73
  .turn-card {
74
  flex: 1;
75
  background: #444;
76
- padding: 10px;
77
  border-radius: 8px;
78
  display: flex;
79
  align-items: center;
@@ -82,11 +82,11 @@
82
  cursor: pointer;
83
  border: 2px solid transparent;
84
  opacity: 0.5;
85
- transition: all 0.3s ease;
86
  }
87
 
88
- .turn-card img { height: 35px; }
89
- .turn-card span { font-weight: bold; }
90
 
91
  .turn-card.active {
92
  opacity: 1;
@@ -114,6 +114,19 @@
114
  border-radius: 8px;
115
  text-align: center;
116
  border: 1px solid #555;
 
 
 
 
 
 
 
 
 
 
 
 
 
117
  }
118
 
119
  .best-move-label { display: block; color: #888; font-size: 0.8em; margin-bottom: 5px; }
@@ -147,7 +160,7 @@
147
  </head>
148
  <body>
149
 
150
- <h1>β™ŸοΈ Arcane Chess</h1>
151
 
152
  <div id="debug-log"></div>
153
 
@@ -165,13 +178,14 @@
165
  </div>
166
 
167
  <div id="board">
168
- <div style="text-align:center;">Loading...<br><small>If stuck, check connection</small></div>
169
  </div>
170
 
171
  <div class="panel">
172
 
173
  <div class="best-move-box">
174
- <span class="best-move-label">BEST MOVE</span>
 
175
  <div id="best-move" class="best-move-text">...</div>
176
 
177
  <div style="display:flex; justify-content:space-between; margin-top:10px; font-size:0.9em; color:#aaa;">
@@ -219,17 +233,11 @@
219
  updateUI();
220
  }
221
 
222
- // --- VISUAL HIGHLIGHT LOGIC ---
223
  function highlightSquares(move) {
224
- // 1. Remove old highlights (Note: 'square-55d63' is the class chessboard.js uses for all squares)
225
  $('#board .square-55d63').removeClass('highlight-best');
226
-
227
- // 2. Parse the move (e.g., "e2e4")
228
  let source = move.substring(0, 2);
229
  let target = move.substring(2, 4);
230
-
231
- // 3. Add highlight class to source and target squares
232
- // Chessboard.js adds classes like .square-e2, .square-a4, etc.
233
  $('#board .square-' + source).addClass('highlight-best');
234
  $('#board .square-' + target).addClass('highlight-best');
235
  }
@@ -290,14 +298,16 @@
290
  if (matchPv) {
291
  let moves = matchPv[1].split(' ');
292
  let bestMove = moves[0];
293
-
294
- // UPDATE TEXT
295
  $('#best-move').html(`➜ ${bestMove}`);
296
-
297
- // UPDATE BOARD HIGHLIGHTS
298
  highlightSquares(bestMove);
299
  }
300
  }
 
 
 
 
 
 
301
  };
302
  engine.postMessage('uci');
303
  engine.postMessage('isready');
@@ -307,14 +317,20 @@
307
  }
308
 
309
  function analyzePosition() {
 
310
  $('#best-move').text('...');
311
- // Clear highlights while thinking so we don't show old info
312
  removeHighlights();
313
-
314
  $('#engineStatus').text('Thinking...');
 
 
 
 
315
  if(engine) {
316
  engine.postMessage(`position fen ${game.fen()}`);
317
- engine.postMessage('go depth 15');
 
 
 
318
  }
319
  }
320
 
@@ -355,7 +371,6 @@
355
 
356
  $('#flipBtn').click(function() {
357
  board.flip();
358
- // Re-apply highlights after flip because DOM is redrawn
359
  let currentText = $('#best-move').text();
360
  if(currentText.includes('➜')) {
361
  let move = currentText.replace('➜ ', '');
 
3
  <head>
4
  <meta charset="UTF-8">
5
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Arcane Fast Analyzer</title>
7
 
8
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.css">
9
 
 
12
  --bg-color: #212121;
13
  --text-color: #e0e0e0;
14
  --accent-color: #4caf50;
15
+ --highlight: #00e5ff;
16
  --panel-bg: #333;
17
  }
18
 
 
28
  user-select: none;
29
  }
30
 
31
+ h1 { margin-bottom: 10px; text-align: center; font-size: 1.5rem; }
32
 
33
  .container {
34
  display: flex;
 
54
  color: #777;
55
  }
56
 
57
+ /* --- HIGHLIGHT CLASS --- */
58
  .highlight-best {
59
  box-shadow: inset 0 0 3px 3px var(--highlight) !important;
60
  background-color: rgba(0, 229, 255, 0.3) !important;
 
73
  .turn-card {
74
  flex: 1;
75
  background: #444;
76
+ padding: 8px;
77
  border-radius: 8px;
78
  display: flex;
79
  align-items: center;
 
82
  cursor: pointer;
83
  border: 2px solid transparent;
84
  opacity: 0.5;
85
+ transition: all 0.2s ease;
86
  }
87
 
88
+ .turn-card img { height: 30px; }
89
+ .turn-card span { font-weight: bold; font-size: 0.9em; }
90
 
91
  .turn-card.active {
92
  opacity: 1;
 
114
  border-radius: 8px;
115
  text-align: center;
116
  border: 1px solid #555;
117
+ position: relative;
118
+ overflow: hidden;
119
+ }
120
+
121
+ /* Loading Bar Animation */
122
+ .loading-bar {
123
+ position: absolute;
124
+ bottom: 0;
125
+ left: 0;
126
+ height: 4px;
127
+ background: var(--highlight);
128
+ width: 0%;
129
+ transition: width 0.1s linear;
130
  }
131
 
132
  .best-move-label { display: block; color: #888; font-size: 0.8em; margin-bottom: 5px; }
 
160
  </head>
161
  <body>
162
 
163
+ <h1>⚑ Arcane Fast Analyzer</h1>
164
 
165
  <div id="debug-log"></div>
166
 
 
178
  </div>
179
 
180
  <div id="board">
181
+ <div style="text-align:center;">Loading...</div>
182
  </div>
183
 
184
  <div class="panel">
185
 
186
  <div class="best-move-box">
187
+ <div id="loading-bar" class="loading-bar"></div>
188
+ <span class="best-move-label">BEST MOVE (2s Limit)</span>
189
  <div id="best-move" class="best-move-text">...</div>
190
 
191
  <div style="display:flex; justify-content:space-between; margin-top:10px; font-size:0.9em; color:#aaa;">
 
233
  updateUI();
234
  }
235
 
236
+ // --- HIGHLIGHTS ---
237
  function highlightSquares(move) {
 
238
  $('#board .square-55d63').removeClass('highlight-best');
 
 
239
  let source = move.substring(0, 2);
240
  let target = move.substring(2, 4);
 
 
 
241
  $('#board .square-' + source).addClass('highlight-best');
242
  $('#board .square-' + target).addClass('highlight-best');
243
  }
 
298
  if (matchPv) {
299
  let moves = matchPv[1].split(' ');
300
  let bestMove = moves[0];
 
 
301
  $('#best-move').html(`➜ ${bestMove}`);
 
 
302
  highlightSquares(bestMove);
303
  }
304
  }
305
+
306
+ // Detect when engine is done (bestmove command)
307
+ if (line.startsWith('bestmove')) {
308
+ $('#loading-bar').css('width', '0%'); // Hide bar
309
+ $('#engineStatus').text('Done');
310
+ }
311
  };
312
  engine.postMessage('uci');
313
  engine.postMessage('isready');
 
317
  }
318
 
319
  function analyzePosition() {
320
+ // Visual Reset
321
  $('#best-move').text('...');
 
322
  removeHighlights();
 
323
  $('#engineStatus').text('Thinking...');
324
+
325
+ // Start Loading Bar Animation
326
+ $('#loading-bar').css('width', '0%').animate({width: '100%'}, 2000);
327
+
328
  if(engine) {
329
  engine.postMessage(`position fen ${game.fen()}`);
330
+
331
+ // --- THE SPEED FIX ---
332
+ // "movetime 2000" means: Think for exactly 2000 milliseconds (2 seconds)
333
+ engine.postMessage('go movetime 2000');
334
  }
335
  }
336
 
 
371
 
372
  $('#flipBtn').click(function() {
373
  board.flip();
 
374
  let currentText = $('#best-move').text();
375
  if(currentText.includes('➜')) {
376
  let move = currentText.replace('➜ ', '');