Spaces:
Running
Running
Add 2 files
Browse files- index.html +26 -42
- prompts.txt +1 -0
index.html
CHANGED
|
@@ -7,6 +7,7 @@
|
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.2/chess.js"></script>
|
|
|
|
| 10 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.js"></script>
|
| 11 |
<style>
|
| 12 |
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');
|
|
@@ -16,10 +17,16 @@
|
|
| 16 |
background-color: #f5f5f5;
|
| 17 |
}
|
| 18 |
|
| 19 |
-
.chessboard {
|
| 20 |
width: 100%;
|
| 21 |
max-width: 500px;
|
| 22 |
margin: 0 auto;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 23 |
}
|
| 24 |
|
| 25 |
.tab-content {
|
|
@@ -69,6 +76,9 @@
|
|
| 69 |
|
| 70 |
.puzzle-theme-btn {
|
| 71 |
transition: all 0.2s;
|
|
|
|
|
|
|
|
|
|
| 72 |
}
|
| 73 |
|
| 74 |
.puzzle-theme-btn.active {
|
|
@@ -81,7 +91,7 @@
|
|
| 81 |
flex-direction: column;
|
| 82 |
}
|
| 83 |
|
| 84 |
-
.chessboard {
|
| 85 |
max-width: 100%;
|
| 86 |
}
|
| 87 |
}
|
|
@@ -129,7 +139,7 @@
|
|
| 129 |
<div class="p-6">
|
| 130 |
<!-- Play Tab -->
|
| 131 |
<div id="play" class="tab-content">
|
| 132 |
-
<!--
|
| 133 |
</div>
|
| 134 |
|
| 135 |
<!-- Puzzles Tab -->
|
|
@@ -137,7 +147,9 @@
|
|
| 137 |
<div class="flex mobile-flex-col gap-6">
|
| 138 |
<!-- Puzzle Board -->
|
| 139 |
<div class="flex-1">
|
| 140 |
-
<div
|
|
|
|
|
|
|
| 141 |
<div class="mt-4 flex justify-center space-x-4">
|
| 142 |
<button id="newPuzzleBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
|
| 143 |
<i class="fas fa-random mr-2"></i>Random Puzzle
|
|
@@ -224,12 +236,12 @@
|
|
| 224 |
|
| 225 |
<!-- Analysis Tab -->
|
| 226 |
<div id="analysis" class="tab-content">
|
| 227 |
-
<!--
|
| 228 |
</div>
|
| 229 |
|
| 230 |
<!-- Learn Tab -->
|
| 231 |
<div id="learn" class="tab-content">
|
| 232 |
-
<!--
|
| 233 |
</div>
|
| 234 |
</div>
|
| 235 |
</div>
|
|
@@ -237,12 +249,12 @@
|
|
| 237 |
|
| 238 |
<!-- Settings Modal -->
|
| 239 |
<div id="settingsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 240 |
-
<!--
|
| 241 |
</div>
|
| 242 |
|
| 243 |
<!-- User Modal -->
|
| 244 |
<div id="userModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 245 |
-
<!--
|
| 246 |
</div>
|
| 247 |
|
| 248 |
<!-- Stockfish Worker -->
|
|
@@ -425,17 +437,6 @@
|
|
| 425 |
|
| 426 |
// Initialize chessboards when DOM is loaded
|
| 427 |
document.addEventListener('DOMContentLoaded', function() {
|
| 428 |
-
// Main game board
|
| 429 |
-
board = Chessboard('board', {
|
| 430 |
-
position: 'start',
|
| 431 |
-
draggable: true,
|
| 432 |
-
dropOffBoard: 'trash',
|
| 433 |
-
sparePieces: false,
|
| 434 |
-
onDragStart: onDragStart,
|
| 435 |
-
onDrop: onDrop,
|
| 436 |
-
onSnapEnd: onSnapEnd
|
| 437 |
-
});
|
| 438 |
-
|
| 439 |
// Puzzle board
|
| 440 |
puzzleBoard = Chessboard('puzzleBoard', {
|
| 441 |
position: 'start',
|
|
@@ -447,23 +448,9 @@
|
|
| 447 |
onSnapEnd: onPuzzleSnapEnd
|
| 448 |
});
|
| 449 |
|
| 450 |
-
// Analysis board
|
| 451 |
-
analysisBoard = Chessboard('analysisBoard', {
|
| 452 |
-
position: 'start',
|
| 453 |
-
draggable: true,
|
| 454 |
-
dropOffBoard: 'trash',
|
| 455 |
-
sparePieces: false,
|
| 456 |
-
onDragStart: onAnalysisDragStart,
|
| 457 |
-
onDrop: onAnalysisDrop,
|
| 458 |
-
onSnapEnd: onAnalysisSnapEnd
|
| 459 |
-
});
|
| 460 |
-
|
| 461 |
// Set up event listeners
|
| 462 |
setupEventListeners();
|
| 463 |
|
| 464 |
-
// Initialize a new game
|
| 465 |
-
newGame();
|
| 466 |
-
|
| 467 |
// Load a random puzzle
|
| 468 |
loadRandomPuzzle();
|
| 469 |
});
|
|
@@ -486,6 +473,11 @@
|
|
| 486 |
});
|
| 487 |
this.classList.add('border-blue-600', 'text-blue-600');
|
| 488 |
this.classList.remove('border-transparent', 'text-gray-600');
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 489 |
});
|
| 490 |
});
|
| 491 |
|
|
@@ -505,16 +497,12 @@
|
|
| 505 |
});
|
| 506 |
});
|
| 507 |
|
| 508 |
-
// ... (other event listeners remain the same as before) ...
|
| 509 |
-
|
| 510 |
// Puzzle controls
|
| 511 |
document.getElementById('newPuzzleBtn').addEventListener('click', loadRandomPuzzle);
|
| 512 |
document.getElementById('importPuzzleBtn').addEventListener('click', toggleImportPuzzleForm);
|
| 513 |
document.getElementById('submitPuzzleBtn').addEventListener('click', importPuzzle);
|
| 514 |
document.getElementById('hintBtn').addEventListener('click', giveHint);
|
| 515 |
document.getElementById('solutionBtn').addEventListener('click', showSolution);
|
| 516 |
-
|
| 517 |
-
// ... (rest of the event listeners remain the same) ...
|
| 518 |
}
|
| 519 |
|
| 520 |
// Load a random puzzle from the database
|
|
@@ -540,7 +528,7 @@
|
|
| 540 |
|
| 541 |
// Load the puzzle position
|
| 542 |
puzzleGame = new Chess(puzzle.fen);
|
| 543 |
-
puzzleBoard.position(puzzle.fen);
|
| 544 |
|
| 545 |
// Convert solution to move objects
|
| 546 |
puzzleSolution = puzzle.solution.map(moveStr => {
|
|
@@ -564,8 +552,6 @@
|
|
| 564 |
document.getElementById('importPuzzleForm').classList.add('hidden');
|
| 565 |
}
|
| 566 |
|
| 567 |
-
// ... (rest of the chess game functions remain the same as before) ...
|
| 568 |
-
|
| 569 |
// Puzzle functions
|
| 570 |
function onPuzzleDragStart(source, piece, position, orientation) {
|
| 571 |
// Only allow dragging if it's the player's turn
|
|
@@ -687,8 +673,6 @@
|
|
| 687 |
alert('No active puzzle!');
|
| 688 |
}
|
| 689 |
}
|
| 690 |
-
|
| 691 |
-
// ... (rest of the functions remain the same as before) ...
|
| 692 |
</script>
|
| 693 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=HuggingeFaceeee/spacee" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 694 |
</html>
|
|
|
|
| 7 |
<script src="https://cdn.tailwindcss.com"></script>
|
| 8 |
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.4.0/css/all.min.css">
|
| 9 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chess.js/0.10.2/chess.js"></script>
|
| 10 |
+
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.css">
|
| 11 |
<script src="https://cdnjs.cloudflare.com/ajax/libs/chessboard-js/1.0.0/chessboard-1.0.0.min.js"></script>
|
| 12 |
<style>
|
| 13 |
@import url('https://fonts.googleapis.com/css2?family=Montserrat:wght@400;600;700&display=swap');
|
|
|
|
| 17 |
background-color: #f5f5f5;
|
| 18 |
}
|
| 19 |
|
| 20 |
+
.chessboard-container {
|
| 21 |
width: 100%;
|
| 22 |
max-width: 500px;
|
| 23 |
margin: 0 auto;
|
| 24 |
+
position: relative;
|
| 25 |
+
}
|
| 26 |
+
|
| 27 |
+
#puzzleBoard {
|
| 28 |
+
width: 100%;
|
| 29 |
+
aspect-ratio: 1/1;
|
| 30 |
}
|
| 31 |
|
| 32 |
.tab-content {
|
|
|
|
| 76 |
|
| 77 |
.puzzle-theme-btn {
|
| 78 |
transition: all 0.2s;
|
| 79 |
+
padding: 0.5rem 1rem;
|
| 80 |
+
border-radius: 0.375rem;
|
| 81 |
+
background-color: #e5e7eb;
|
| 82 |
}
|
| 83 |
|
| 84 |
.puzzle-theme-btn.active {
|
|
|
|
| 91 |
flex-direction: column;
|
| 92 |
}
|
| 93 |
|
| 94 |
+
.chessboard-container {
|
| 95 |
max-width: 100%;
|
| 96 |
}
|
| 97 |
}
|
|
|
|
| 139 |
<div class="p-6">
|
| 140 |
<!-- Play Tab -->
|
| 141 |
<div id="play" class="tab-content">
|
| 142 |
+
<!-- Play tab content would go here -->
|
| 143 |
</div>
|
| 144 |
|
| 145 |
<!-- Puzzles Tab -->
|
|
|
|
| 147 |
<div class="flex mobile-flex-col gap-6">
|
| 148 |
<!-- Puzzle Board -->
|
| 149 |
<div class="flex-1">
|
| 150 |
+
<div class="chessboard-container">
|
| 151 |
+
<div id="puzzleBoard"></div>
|
| 152 |
+
</div>
|
| 153 |
<div class="mt-4 flex justify-center space-x-4">
|
| 154 |
<button id="newPuzzleBtn" class="bg-blue-600 hover:bg-blue-700 text-white px-4 py-2 rounded-lg">
|
| 155 |
<i class="fas fa-random mr-2"></i>Random Puzzle
|
|
|
|
| 236 |
|
| 237 |
<!-- Analysis Tab -->
|
| 238 |
<div id="analysis" class="tab-content">
|
| 239 |
+
<!-- Analysis tab content would go here -->
|
| 240 |
</div>
|
| 241 |
|
| 242 |
<!-- Learn Tab -->
|
| 243 |
<div id="learn" class="tab-content">
|
| 244 |
+
<!-- Learn tab content would go here -->
|
| 245 |
</div>
|
| 246 |
</div>
|
| 247 |
</div>
|
|
|
|
| 249 |
|
| 250 |
<!-- Settings Modal -->
|
| 251 |
<div id="settingsModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 252 |
+
<!-- Settings modal content would go here -->
|
| 253 |
</div>
|
| 254 |
|
| 255 |
<!-- User Modal -->
|
| 256 |
<div id="userModal" class="fixed inset-0 bg-black bg-opacity-50 flex items-center justify-center hidden">
|
| 257 |
+
<!-- User modal content would go here -->
|
| 258 |
</div>
|
| 259 |
|
| 260 |
<!-- Stockfish Worker -->
|
|
|
|
| 437 |
|
| 438 |
// Initialize chessboards when DOM is loaded
|
| 439 |
document.addEventListener('DOMContentLoaded', function() {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 440 |
// Puzzle board
|
| 441 |
puzzleBoard = Chessboard('puzzleBoard', {
|
| 442 |
position: 'start',
|
|
|
|
| 448 |
onSnapEnd: onPuzzleSnapEnd
|
| 449 |
});
|
| 450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 451 |
// Set up event listeners
|
| 452 |
setupEventListeners();
|
| 453 |
|
|
|
|
|
|
|
|
|
|
| 454 |
// Load a random puzzle
|
| 455 |
loadRandomPuzzle();
|
| 456 |
});
|
|
|
|
| 473 |
});
|
| 474 |
this.classList.add('border-blue-600', 'text-blue-600');
|
| 475 |
this.classList.remove('border-transparent', 'text-gray-600');
|
| 476 |
+
|
| 477 |
+
// Resize board when tab changes
|
| 478 |
+
setTimeout(() => {
|
| 479 |
+
if (puzzleBoard) puzzleBoard.resize();
|
| 480 |
+
}, 10);
|
| 481 |
});
|
| 482 |
});
|
| 483 |
|
|
|
|
| 497 |
});
|
| 498 |
});
|
| 499 |
|
|
|
|
|
|
|
| 500 |
// Puzzle controls
|
| 501 |
document.getElementById('newPuzzleBtn').addEventListener('click', loadRandomPuzzle);
|
| 502 |
document.getElementById('importPuzzleBtn').addEventListener('click', toggleImportPuzzleForm);
|
| 503 |
document.getElementById('submitPuzzleBtn').addEventListener('click', importPuzzle);
|
| 504 |
document.getElementById('hintBtn').addEventListener('click', giveHint);
|
| 505 |
document.getElementById('solutionBtn').addEventListener('click', showSolution);
|
|
|
|
|
|
|
| 506 |
}
|
| 507 |
|
| 508 |
// Load a random puzzle from the database
|
|
|
|
| 528 |
|
| 529 |
// Load the puzzle position
|
| 530 |
puzzleGame = new Chess(puzzle.fen);
|
| 531 |
+
puzzleBoard.position(puzzle.fen, false); // false to prevent animation
|
| 532 |
|
| 533 |
// Convert solution to move objects
|
| 534 |
puzzleSolution = puzzle.solution.map(moveStr => {
|
|
|
|
| 552 |
document.getElementById('importPuzzleForm').classList.add('hidden');
|
| 553 |
}
|
| 554 |
|
|
|
|
|
|
|
| 555 |
// Puzzle functions
|
| 556 |
function onPuzzleDragStart(source, piece, position, orientation) {
|
| 557 |
// Only allow dragging if it's the player's turn
|
|
|
|
| 673 |
alert('No active puzzle!');
|
| 674 |
}
|
| 675 |
}
|
|
|
|
|
|
|
| 676 |
</script>
|
| 677 |
<p style="border-radius: 8px; text-align: center; font-size: 12px; color: #fff; margin-top: 16px;position: fixed; left: 8px; bottom: 8px; z-index: 10; background: rgba(0, 0, 0, 0.8); padding: 4px 8px;">Made with <img src="https://enzostvs-deepsite.hf.space/logo.svg" alt="DeepSite Logo" style="width: 16px; height: 16px; vertical-align: middle;display:inline-block;margin-right:3px;filter:brightness(0) invert(1);"><a href="https://enzostvs-deepsite.hf.space" style="color: #fff;text-decoration: underline;" target="_blank" >DeepSite</a> - 🧬 <a href="https://enzostvs-deepsite.hf.space?remix=HuggingeFaceeee/spacee" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 678 |
</html>
|
prompts.txt
CHANGED
|
@@ -0,0 +1 @@
|
|
|
|
|
|
|
| 1 |
+
it doesn't show the board
|