Add 3 files
Browse files- README.md +6 -4
- index.html +761 -19
- prompts.txt +0 -0
README.md
CHANGED
|
@@ -1,10 +1,12 @@
|
|
| 1 |
---
|
| 2 |
-
title:
|
| 3 |
-
emoji:
|
| 4 |
-
colorFrom:
|
| 5 |
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
|
|
|
|
|
|
| 8 |
---
|
| 9 |
|
| 10 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 1 |
---
|
| 2 |
+
title: goldman
|
| 3 |
+
emoji: 🐳
|
| 4 |
+
colorFrom: blue
|
| 5 |
colorTo: green
|
| 6 |
sdk: static
|
| 7 |
pinned: false
|
| 8 |
+
tags:
|
| 9 |
+
- deepsite
|
| 10 |
---
|
| 11 |
|
| 12 |
+
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
index.html
CHANGED
|
@@ -1,19 +1,761 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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|
|
|
|
|
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>Desert Tetrix</title>
|
| 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 |
+
<style>
|
| 10 |
+
@keyframes pulse {
|
| 11 |
+
0% { opacity: 0.7; }
|
| 12 |
+
50% { opacity: 1; }
|
| 13 |
+
100% { opacity: 0.7; }
|
| 14 |
+
}
|
| 15 |
+
|
| 16 |
+
.pulse {
|
| 17 |
+
animation: pulse 2s infinite;
|
| 18 |
+
}
|
| 19 |
+
|
| 20 |
+
.game-container {
|
| 21 |
+
perspective: 1000px;
|
| 22 |
+
}
|
| 23 |
+
|
| 24 |
+
.game-board {
|
| 25 |
+
transform-style: preserve-3d;
|
| 26 |
+
box-shadow: 0 10px 30px rgba(210, 180, 140, 0.5);
|
| 27 |
+
}
|
| 28 |
+
|
| 29 |
+
.block {
|
| 30 |
+
transition: all 0.1s;
|
| 31 |
+
}
|
| 32 |
+
|
| 33 |
+
.block.i { background-color: #F4A460; } /* Sandstone */
|
| 34 |
+
.block.j { background-color: #CD853F; } /* Peru */
|
| 35 |
+
.block.l { background-color: #D2B48C; } /* Tan */
|
| 36 |
+
.block.o { background-color: #DEB887; } /* Burlywood */
|
| 37 |
+
.block.s { background-color: #BC8F8F; } /* Rosy Brown */
|
| 38 |
+
.block.t { background-color: #DAA520; } /* Goldenrod */
|
| 39 |
+
.block.z { background-color: #B8860B; } /* Dark Goldenrod */
|
| 40 |
+
|
| 41 |
+
.shadow {
|
| 42 |
+
filter: brightness(0.7);
|
| 43 |
+
}
|
| 44 |
+
|
| 45 |
+
.game-overlay {
|
| 46 |
+
background-color: rgba(210, 180, 140, 0.7);
|
| 47 |
+
backdrop-filter: blur(5px);
|
| 48 |
+
}
|
| 49 |
+
|
| 50 |
+
.camel-icon {
|
| 51 |
+
transform: scaleX(-1);
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.control-btn {
|
| 55 |
+
touch-action: manipulation;
|
| 56 |
+
user-select: none;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
@media (hover: hover) {
|
| 60 |
+
.mobile-controls {
|
| 61 |
+
display: none;
|
| 62 |
+
}
|
| 63 |
+
}
|
| 64 |
+
|
| 65 |
+
@media (hover: none) {
|
| 66 |
+
.mobile-controls {
|
| 67 |
+
display: flex;
|
| 68 |
+
}
|
| 69 |
+
}
|
| 70 |
+
</style>
|
| 71 |
+
</head>
|
| 72 |
+
<body class="bg-amber-50 font-sans flex flex-col items-center justify-center min-h-screen p-4">
|
| 73 |
+
<div class="game-container mb-8">
|
| 74 |
+
<h1 class="text-4xl font-bold text-amber-800 mb-2 text-center">Desert Tetrix</h1>
|
| 75 |
+
<p class="text-amber-700 mb-6 text-center">Survive the shifting sands!</p>
|
| 76 |
+
|
| 77 |
+
<div class="flex flex-col md:flex-row gap-8 items-center md:items-start">
|
| 78 |
+
<div class="relative">
|
| 79 |
+
<div class="game-board bg-amber-100 border-4 border-amber-300 rounded relative" id="game-board">
|
| 80 |
+
<!-- Game board will be rendered here -->
|
| 81 |
+
</div>
|
| 82 |
+
|
| 83 |
+
<div class="game-overlay absolute inset-0 flex flex-col items-center justify-center hidden" id="game-overlay">
|
| 84 |
+
<h2 class="text-3xl font-bold text-amber-900 mb-4">Game Over!</h2>
|
| 85 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white font-bold py-2 px-6 rounded-full transition" id="restart-btn">
|
| 86 |
+
Try Again <i class="fas fa-redo ml-2"></i>
|
| 87 |
+
</button>
|
| 88 |
+
</div>
|
| 89 |
+
</div>
|
| 90 |
+
|
| 91 |
+
<div class="bg-amber-100 border-4 border-amber-300 rounded p-4 w-full md:w-64">
|
| 92 |
+
<div class="mb-6">
|
| 93 |
+
<h3 class="text-xl font-bold text-amber-800 mb-2">Next Piece:</h3>
|
| 94 |
+
<div class="bg-amber-50 border-2 border-amber-200 rounded p-2 h-24 flex items-center justify-center" id="next-piece">
|
| 95 |
+
<!-- Next piece preview -->
|
| 96 |
+
</div>
|
| 97 |
+
</div>
|
| 98 |
+
|
| 99 |
+
<div class="mb-6">
|
| 100 |
+
<h3 class="text-xl font-bold text-amber-800 mb-2">Score:</h3>
|
| 101 |
+
<div class="bg-amber-50 border-2 border-amber-200 rounded p-3 text-center">
|
| 102 |
+
<span class="text-2xl font-bold text-amber-900" id="score">0</span>
|
| 103 |
+
</div>
|
| 104 |
+
</div>
|
| 105 |
+
|
| 106 |
+
<div class="mb-6">
|
| 107 |
+
<h3 class="text-xl font-bold text-amber-800 mb-2">Level:</h3>
|
| 108 |
+
<div class="bg-amber-50 border-2 border-amber-200 rounded p-3 text-center">
|
| 109 |
+
<span class="text-2xl font-bold text-amber-900" id="level">1</span>
|
| 110 |
+
</div>
|
| 111 |
+
</div>
|
| 112 |
+
|
| 113 |
+
<div class="mb-6">
|
| 114 |
+
<h3 class="text-xl font-bold text-amber-800 mb-2">Lines:</h3>
|
| 115 |
+
<div class="bg-amber-50 border-2 border-amber-200 rounded p-3 text-center">
|
| 116 |
+
<span class="text-2xl font-bold text-amber-900" id="lines">0</span>
|
| 117 |
+
</div>
|
| 118 |
+
</div>
|
| 119 |
+
|
| 120 |
+
<div class="flex flex-col gap-2">
|
| 121 |
+
<button class="bg-amber-600 hover:bg-amber-700 text-white font-bold py-2 px-4 rounded transition" id="pause-btn">
|
| 122 |
+
<i class="fas fa-pause mr-2"></i> Pause
|
| 123 |
+
</button>
|
| 124 |
+
<button class="bg-amber-500 hover:bg-amber-600 text-white font-bold py-2 px-4 rounded transition" id="sound-btn">
|
| 125 |
+
<i class="fas fa-volume-up mr-2"></i> Sound On
|
| 126 |
+
</button>
|
| 127 |
+
</div>
|
| 128 |
+
</div>
|
| 129 |
+
</div>
|
| 130 |
+
|
| 131 |
+
<!-- Mobile Controls -->
|
| 132 |
+
<div class="mobile-controls mt-4 w-full max-w-md">
|
| 133 |
+
<div class="grid grid-cols-3 gap-2">
|
| 134 |
+
<div></div>
|
| 135 |
+
<button id="rotate-btn" class="control-btn bg-amber-600 text-white font-bold py-4 rounded-full flex items-center justify-center">
|
| 136 |
+
<i class="fas fa-rotate text-2xl"></i>
|
| 137 |
+
</button>
|
| 138 |
+
<div></div>
|
| 139 |
+
|
| 140 |
+
<button id="left-btn" class="control-btn bg-amber-600 text-white font-bold py-4 rounded-full flex items-center justify-center">
|
| 141 |
+
<i class="fas fa-arrow-left text-2xl"></i>
|
| 142 |
+
</button>
|
| 143 |
+
<button id="down-btn" class="control-btn bg-amber-600 text-white font-bold py-4 rounded-full flex items-center justify-center">
|
| 144 |
+
<i class="fas fa-arrow-down text-2xl"></i>
|
| 145 |
+
</button>
|
| 146 |
+
<button id="right-btn" class="control-btn bg-amber-600 text-white font-bold py-4 rounded-full flex items-center justify-center">
|
| 147 |
+
<i class="fas fa-arrow-right text-2xl"></i>
|
| 148 |
+
</button>
|
| 149 |
+
|
| 150 |
+
<button id="hard-drop-btn" class="control-btn bg-amber-700 text-white font-bold py-3 rounded-full flex items-center justify-center col-span-3">
|
| 151 |
+
<i class="fas fa-arrow-down-to-line mr-2"></i> Hard Drop
|
| 152 |
+
</button>
|
| 153 |
+
</div>
|
| 154 |
+
</div>
|
| 155 |
+
</div>
|
| 156 |
+
|
| 157 |
+
<div class="bg-amber-100 border-4 border-amber-300 rounded p-4 max-w-2xl w-full">
|
| 158 |
+
<h3 class="text-xl font-bold text-amber-800 mb-3">How to Play:</h3>
|
| 159 |
+
<div class="grid grid-cols-2 gap-4">
|
| 160 |
+
<div class="flex items-center">
|
| 161 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 162 |
+
<i class="fas fa-arrow-up text-amber-800"></i>
|
| 163 |
+
</div>
|
| 164 |
+
<span class="text-amber-700">Rotate</span>
|
| 165 |
+
</div>
|
| 166 |
+
<div class="flex items-center">
|
| 167 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 168 |
+
<i class="fas fa-arrow-left text-amber-800"></i>
|
| 169 |
+
</div>
|
| 170 |
+
<span class="text-amber-700">Move Left</span>
|
| 171 |
+
</div>
|
| 172 |
+
<div class="flex items-center">
|
| 173 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 174 |
+
<i class="fas fa-arrow-right text-amber-800"></i>
|
| 175 |
+
</div>
|
| 176 |
+
<span class="text-amber-700">Move Right</span>
|
| 177 |
+
</div>
|
| 178 |
+
<div class="flex items-center">
|
| 179 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 180 |
+
<i class="fas fa-arrow-down text-amber-800"></i>
|
| 181 |
+
</div>
|
| 182 |
+
<span class="text-amber-700">Soft Drop</span>
|
| 183 |
+
</div>
|
| 184 |
+
<div class="flex items-center">
|
| 185 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 186 |
+
<i class="fas fa-space-shuttle text-amber-800"></i>
|
| 187 |
+
</div>
|
| 188 |
+
<span class="text-amber-700">Hard Drop</span>
|
| 189 |
+
</div>
|
| 190 |
+
<div class="flex items-center">
|
| 191 |
+
<div class="bg-amber-200 rounded-full w-10 h-10 flex items-center justify-center mr-3">
|
| 192 |
+
<i class="fas fa-pause text-amber-800"></i>
|
| 193 |
+
</div>
|
| 194 |
+
<span class="text-amber-700">Pause</span>
|
| 195 |
+
</div>
|
| 196 |
+
</div>
|
| 197 |
+
</div>
|
| 198 |
+
|
| 199 |
+
<div class="mt-8 text-center text-amber-700">
|
| 200 |
+
<p>Watch out for the desert storms! They'll speed up the game.</p>
|
| 201 |
+
<div class="flex justify-center mt-2">
|
| 202 |
+
<i class="fas fa-sun text-amber-500 text-2xl mx-1 pulse"></i>
|
| 203 |
+
<i class="fas fa-wind text-amber-600 text-2xl mx-1"></i>
|
| 204 |
+
<i class="fas fa-cloud text-amber-700 text-2xl mx-1"></i>
|
| 205 |
+
</div>
|
| 206 |
+
</div>
|
| 207 |
+
|
| 208 |
+
<script>
|
| 209 |
+
// Game constants
|
| 210 |
+
const COLS = 10;
|
| 211 |
+
const ROWS = 20;
|
| 212 |
+
const BLOCK_SIZE = 30;
|
| 213 |
+
const NEXT_PIECE_COLS = 4;
|
| 214 |
+
const NEXT_PIECE_ROWS = 4;
|
| 215 |
+
|
| 216 |
+
// Game variables
|
| 217 |
+
let board = Array(ROWS).fill().map(() => Array(COLS).fill(0));
|
| 218 |
+
let currentPiece = null;
|
| 219 |
+
let nextPiece = null;
|
| 220 |
+
let score = 0;
|
| 221 |
+
let level = 1;
|
| 222 |
+
let lines = 0;
|
| 223 |
+
let gameOver = false;
|
| 224 |
+
let isPaused = false;
|
| 225 |
+
let soundOn = true;
|
| 226 |
+
let dropInterval;
|
| 227 |
+
let dropStart;
|
| 228 |
+
|
| 229 |
+
// DOM elements
|
| 230 |
+
const gameBoard = document.getElementById('game-board');
|
| 231 |
+
const nextPieceDisplay = document.getElementById('next-piece');
|
| 232 |
+
const scoreDisplay = document.getElementById('score');
|
| 233 |
+
const levelDisplay = document.getElementById('level');
|
| 234 |
+
const linesDisplay = document.getElementById('lines');
|
| 235 |
+
const gameOverlay = document.getElementById('game-overlay');
|
| 236 |
+
const pauseBtn = document.getElementById('pause-btn');
|
| 237 |
+
const soundBtn = document.getElementById('sound-btn');
|
| 238 |
+
const restartBtn = document.getElementById('restart-btn');
|
| 239 |
+
|
| 240 |
+
// Mobile control buttons
|
| 241 |
+
const rotateBtn = document.getElementById('rotate-btn');
|
| 242 |
+
const leftBtn = document.getElementById('left-btn');
|
| 243 |
+
const rightBtn = document.getElementById('right-btn');
|
| 244 |
+
const downBtn = document.getElementById('down-btn');
|
| 245 |
+
const hardDropBtn = document.getElementById('hard-drop-btn');
|
| 246 |
+
|
| 247 |
+
// Set up the game board
|
| 248 |
+
gameBoard.style.width = `${COLS * BLOCK_SIZE}px`;
|
| 249 |
+
gameBoard.style.height = `${ROWS * BLOCK_SIZE}px`;
|
| 250 |
+
|
| 251 |
+
// Set up the next piece display
|
| 252 |
+
nextPieceDisplay.style.width = `${NEXT_PIECE_COLS * BLOCK_SIZE}px`;
|
| 253 |
+
nextPieceDisplay.style.height = `${NEXT_PIECE_ROWS * BLOCK_SIZE}px`;
|
| 254 |
+
|
| 255 |
+
// Tetromino shapes with desert-themed names
|
| 256 |
+
const SHAPES = {
|
| 257 |
+
i: {
|
| 258 |
+
shape: [
|
| 259 |
+
[0, 0, 0, 0],
|
| 260 |
+
[1, 1, 1, 1],
|
| 261 |
+
[0, 0, 0, 0],
|
| 262 |
+
[0, 0, 0, 0]
|
| 263 |
+
],
|
| 264 |
+
name: 'Sand Dune'
|
| 265 |
+
},
|
| 266 |
+
j: {
|
| 267 |
+
shape: [
|
| 268 |
+
[1, 0, 0],
|
| 269 |
+
[1, 1, 1],
|
| 270 |
+
[0, 0, 0]
|
| 271 |
+
],
|
| 272 |
+
name: 'Camel Hump'
|
| 273 |
+
},
|
| 274 |
+
l: {
|
| 275 |
+
shape: [
|
| 276 |
+
[0, 0, 1],
|
| 277 |
+
[1, 1, 1],
|
| 278 |
+
[0, 0, 0]
|
| 279 |
+
],
|
| 280 |
+
name: 'Mirage'
|
| 281 |
+
},
|
| 282 |
+
o: {
|
| 283 |
+
shape: [
|
| 284 |
+
[1, 1],
|
| 285 |
+
[1, 1]
|
| 286 |
+
],
|
| 287 |
+
name: 'Oasis'
|
| 288 |
+
},
|
| 289 |
+
s: {
|
| 290 |
+
shape: [
|
| 291 |
+
[0, 1, 1],
|
| 292 |
+
[1, 1, 0],
|
| 293 |
+
[0, 0, 0]
|
| 294 |
+
],
|
| 295 |
+
name: 'Snake'
|
| 296 |
+
},
|
| 297 |
+
t: {
|
| 298 |
+
shape: [
|
| 299 |
+
[0, 1, 0],
|
| 300 |
+
[1, 1, 1],
|
| 301 |
+
[0, 0, 0]
|
| 302 |
+
],
|
| 303 |
+
name: 'Tumbleweed'
|
| 304 |
+
},
|
| 305 |
+
z: {
|
| 306 |
+
shape: [
|
| 307 |
+
[1, 1, 0],
|
| 308 |
+
[0, 1, 1],
|
| 309 |
+
[0, 0, 0]
|
| 310 |
+
],
|
| 311 |
+
name: 'Zigzag'
|
| 312 |
+
}
|
| 313 |
+
};
|
| 314 |
+
|
| 315 |
+
// Colors for each tetromino type
|
| 316 |
+
const COLORS = {
|
| 317 |
+
i: 'i',
|
| 318 |
+
j: 'j',
|
| 319 |
+
l: 'l',
|
| 320 |
+
o: 'o',
|
| 321 |
+
s: 's',
|
| 322 |
+
t: 't',
|
| 323 |
+
z: 'z'
|
| 324 |
+
};
|
| 325 |
+
|
| 326 |
+
// Sound effects
|
| 327 |
+
const sounds = {
|
| 328 |
+
rotate: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-game-click-1114.mp3'),
|
| 329 |
+
move: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-quick-jump-arcade-game-239.mp3'),
|
| 330 |
+
drop: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-arcade-game-jump-coin-216.mp3'),
|
| 331 |
+
clear: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-winning-chimes-2015.mp3'),
|
| 332 |
+
gameOver: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-retro-arcade-lose-2027.mp3'),
|
| 333 |
+
levelUp: new Audio('https://assets.mixkit.co/sfx/preview/mixkit-achievement-bell-600.mp3')
|
| 334 |
+
};
|
| 335 |
+
|
| 336 |
+
// Initialize the game
|
| 337 |
+
function init() {
|
| 338 |
+
createBoard();
|
| 339 |
+
createNextPiece();
|
| 340 |
+
spawnPiece();
|
| 341 |
+
draw();
|
| 342 |
+
startGame();
|
| 343 |
+
addEventListeners();
|
| 344 |
+
}
|
| 345 |
+
|
| 346 |
+
// Create the game board grid
|
| 347 |
+
function createBoard() {
|
| 348 |
+
gameBoard.innerHTML = '';
|
| 349 |
+
|
| 350 |
+
for (let row = 0; row < ROWS; row++) {
|
| 351 |
+
for (let col = 0; col < COLS; col++) {
|
| 352 |
+
const block = document.createElement('div');
|
| 353 |
+
block.classList.add('block', 'absolute', 'border', 'border-amber-200');
|
| 354 |
+
block.style.width = `${BLOCK_SIZE}px`;
|
| 355 |
+
block.style.height = `${BLOCK_SIZE}px`;
|
| 356 |
+
block.style.left = `${col * BLOCK_SIZE}px`;
|
| 357 |
+
block.style.top = `${row * BLOCK_SIZE}px`;
|
| 358 |
+
block.dataset.row = row;
|
| 359 |
+
block.dataset.col = col;
|
| 360 |
+
gameBoard.appendChild(block);
|
| 361 |
+
}
|
| 362 |
+
}
|
| 363 |
+
}
|
| 364 |
+
|
| 365 |
+
// Create the next piece display grid
|
| 366 |
+
function createNextPieceDisplay() {
|
| 367 |
+
nextPieceDisplay.innerHTML = '';
|
| 368 |
+
|
| 369 |
+
for (let row = 0; row < NEXT_PIECE_ROWS; row++) {
|
| 370 |
+
for (let col = 0; col < NEXT_PIECE_COLS; col++) {
|
| 371 |
+
const block = document.createElement('div');
|
| 372 |
+
block.classList.add('block', 'absolute', 'border', 'border-amber-200');
|
| 373 |
+
block.style.width = `${BLOCK_SIZE}px`;
|
| 374 |
+
block.style.height = `${BLOCK_SIZE}px`;
|
| 375 |
+
block.style.left = `${col * BLOCK_SIZE}px`;
|
| 376 |
+
block.style.top = `${row * BLOCK_SIZE}px`;
|
| 377 |
+
nextPieceDisplay.appendChild(block);
|
| 378 |
+
}
|
| 379 |
+
}
|
| 380 |
+
}
|
| 381 |
+
|
| 382 |
+
// Draw the current game state
|
| 383 |
+
function draw() {
|
| 384 |
+
// Clear the board
|
| 385 |
+
document.querySelectorAll('#game-board .block').forEach(block => {
|
| 386 |
+
block.className = 'block absolute border border-amber-200';
|
| 387 |
+
block.innerHTML = '';
|
| 388 |
+
});
|
| 389 |
+
|
| 390 |
+
// Draw the locked pieces
|
| 391 |
+
for (let row = 0; row < ROWS; row++) {
|
| 392 |
+
for (let col = 0; col < COLS; col++) {
|
| 393 |
+
if (board[row][col]) {
|
| 394 |
+
const block = document.querySelector(`#game-board .block[data-row="${row}"][data-col="${col}"]`);
|
| 395 |
+
block.classList.add(`block-${board[row][col]}`);
|
| 396 |
+
|
| 397 |
+
// Add camel icon for some pieces
|
| 398 |
+
if (Math.random() > 0.7) {
|
| 399 |
+
const icon = document.createElement('i');
|
| 400 |
+
icon.classList.add('fas', 'fa-horse', 'camel-icon', 'text-amber-900', 'opacity-50', 'text-xs');
|
| 401 |
+
block.appendChild(icon);
|
| 402 |
+
}
|
| 403 |
+
}
|
| 404 |
+
}
|
| 405 |
+
}
|
| 406 |
+
|
| 407 |
+
// Draw the current piece
|
| 408 |
+
if (currentPiece) {
|
| 409 |
+
for (let row = 0; row < currentPiece.shape.length; row++) {
|
| 410 |
+
for (let col = 0; col < currentPiece.shape[row].length; col++) {
|
| 411 |
+
if (currentPiece.shape[row][col]) {
|
| 412 |
+
const boardRow = currentPiece.row + row;
|
| 413 |
+
const boardCol = currentPiece.col + col;
|
| 414 |
+
|
| 415 |
+
if (boardRow >= 0 && boardRow < ROWS && boardCol >= 0 && boardCol < COLS) {
|
| 416 |
+
const block = document.querySelector(`#game-board .block[data-row="${boardRow}"][data-col="${boardCol}"]`);
|
| 417 |
+
block.classList.add(`block-${currentPiece.type}`);
|
| 418 |
+
|
| 419 |
+
// Add cactus icon for current piece
|
| 420 |
+
if (currentPiece.type === 't' || currentPiece.type === 'j') {
|
| 421 |
+
const icon = document.createElement('i');
|
| 422 |
+
icon.classList.add('fas', 'fa-cactus', 'text-amber-900', 'opacity-70', 'text-xs');
|
| 423 |
+
block.appendChild(icon);
|
| 424 |
+
}
|
| 425 |
+
}
|
| 426 |
+
}
|
| 427 |
+
}
|
| 428 |
+
}
|
| 429 |
+
}
|
| 430 |
+
|
| 431 |
+
// Draw the next piece
|
| 432 |
+
createNextPieceDisplay();
|
| 433 |
+
if (nextPiece) {
|
| 434 |
+
const centerX = Math.floor((NEXT_PIECE_COLS - nextPiece.shape[0].length) / 2);
|
| 435 |
+
const centerY = Math.floor((NEXT_PIECE_ROWS - nextPiece.shape.length) / 2);
|
| 436 |
+
|
| 437 |
+
for (let row = 0; row < nextPiece.shape.length; row++) {
|
| 438 |
+
for (let col = 0; col < nextPiece.shape[row].length; col++) {
|
| 439 |
+
if (nextPiece.shape[row][col]) {
|
| 440 |
+
const displayRow = centerY + row;
|
| 441 |
+
const displayCol = centerX + col;
|
| 442 |
+
const block = nextPieceDisplay.children[displayRow * NEXT_PIECE_COLS + displayCol];
|
| 443 |
+
block.classList.add(`block-${nextPiece.type}`);
|
| 444 |
+
|
| 445 |
+
// Add desert icon for next piece
|
| 446 |
+
if (nextPiece.type === 'o') {
|
| 447 |
+
const icon = document.createElement('i');
|
| 448 |
+
icon.classList.add('fas', 'fa-umbrella-beach', 'text-amber-900', 'opacity-70', 'text-xs');
|
| 449 |
+
block.appendChild(icon);
|
| 450 |
+
}
|
| 451 |
+
}
|
| 452 |
+
}
|
| 453 |
+
}
|
| 454 |
+
}
|
| 455 |
+
|
| 456 |
+
// Update score, level, and lines
|
| 457 |
+
scoreDisplay.textContent = score;
|
| 458 |
+
levelDisplay.textContent = level;
|
| 459 |
+
linesDisplay.textContent = lines;
|
| 460 |
+
}
|
| 461 |
+
|
| 462 |
+
// Create a new random piece
|
| 463 |
+
function createPiece() {
|
| 464 |
+
const types = Object.keys(SHAPES);
|
| 465 |
+
const randomType = types[Math.floor(Math.random() * types.length)];
|
| 466 |
+
return {
|
| 467 |
+
type: randomType,
|
| 468 |
+
shape: SHAPES[randomType].shape,
|
| 469 |
+
row: 0,
|
| 470 |
+
col: Math.floor(COLS / 2) - Math.floor(SHAPES[randomType].shape[0].length / 2)
|
| 471 |
+
};
|
| 472 |
+
}
|
| 473 |
+
|
| 474 |
+
// Create the next piece
|
| 475 |
+
function createNextPiece() {
|
| 476 |
+
nextPiece = createPiece();
|
| 477 |
+
}
|
| 478 |
+
|
| 479 |
+
// Spawn the next piece
|
| 480 |
+
function spawnPiece() {
|
| 481 |
+
currentPiece = nextPiece;
|
| 482 |
+
createNextPiece();
|
| 483 |
+
|
| 484 |
+
// Check if game over
|
| 485 |
+
if (collision()) {
|
| 486 |
+
gameOver = true;
|
| 487 |
+
if (soundOn) sounds.gameOver.play();
|
| 488 |
+
clearInterval(dropInterval);
|
| 489 |
+
gameOverlay.classList.remove('hidden');
|
| 490 |
+
}
|
| 491 |
+
}
|
| 492 |
+
|
| 493 |
+
// Check for collisions
|
| 494 |
+
function collision() {
|
| 495 |
+
for (let row = 0; row < currentPiece.shape.length; row++) {
|
| 496 |
+
for (let col = 0; col < currentPiece.shape[row].length; col++) {
|
| 497 |
+
if (currentPiece.shape[row][col]) {
|
| 498 |
+
const boardRow = currentPiece.row + row;
|
| 499 |
+
const boardCol = currentPiece.col + col;
|
| 500 |
+
|
| 501 |
+
if (
|
| 502 |
+
boardRow >= ROWS ||
|
| 503 |
+
boardCol < 0 ||
|
| 504 |
+
boardCol >= COLS ||
|
| 505 |
+
(boardRow >= 0 && board[boardRow][boardCol])
|
| 506 |
+
) {
|
| 507 |
+
return true;
|
| 508 |
+
}
|
| 509 |
+
}
|
| 510 |
+
}
|
| 511 |
+
}
|
| 512 |
+
return false;
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
// Rotate the current piece
|
| 516 |
+
function rotate() {
|
| 517 |
+
if (isPaused || gameOver) return;
|
| 518 |
+
|
| 519 |
+
const originalShape = currentPiece.shape;
|
| 520 |
+
const originalCol = currentPiece.col;
|
| 521 |
+
|
| 522 |
+
// Transpose and reverse rows to rotate clockwise
|
| 523 |
+
const rows = currentPiece.shape.length;
|
| 524 |
+
const cols = currentPiece.shape[0].length;
|
| 525 |
+
const newShape = Array(cols).fill().map(() => Array(rows).fill(0));
|
| 526 |
+
|
| 527 |
+
for (let row = 0; row; row++) {
|
| 528 |
+
for (let col = 0; col < cols; col++) {
|
| 529 |
+
newShape[col][rows - 1 - row] = currentPiece.shape[row][col];
|
| 530 |
+
}
|
| 531 |
+
}
|
| 532 |
+
|
| 533 |
+
currentPiece.shape = newShape;
|
| 534 |
+
|
| 535 |
+
// Adjust position if rotation causes collision
|
| 536 |
+
while (collision()) {
|
| 537 |
+
currentPiece.col--;
|
| 538 |
+
}
|
| 539 |
+
|
| 540 |
+
if (collision()) {
|
| 541 |
+
currentPiece.shape = originalShape;
|
| 542 |
+
currentPiece.col = originalCol;
|
| 543 |
+
} else {
|
| 544 |
+
if (soundOn) sounds.rotate.play();
|
| 545 |
+
draw();
|
| 546 |
+
}
|
| 547 |
+
}
|
| 548 |
+
|
| 549 |
+
// Move the current piece left
|
| 550 |
+
function moveLeft() {
|
| 551 |
+
if (isPaused || gameOver) return;
|
| 552 |
+
|
| 553 |
+
currentPiece.col--;
|
| 554 |
+
if (collision()) {
|
| 555 |
+
currentPiece.col++;
|
| 556 |
+
} else {
|
| 557 |
+
if (soundOn) sounds.move.play();
|
| 558 |
+
draw();
|
| 559 |
+
}
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
// Move the current piece right
|
| 563 |
+
function moveRight() {
|
| 564 |
+
if (isPaused || gameOver) return;
|
| 565 |
+
|
| 566 |
+
currentPiece.col++;
|
| 567 |
+
if (collision()) {
|
| 568 |
+
currentPiece.col--;
|
| 569 |
+
} else {
|
| 570 |
+
if (soundOn) sounds.move.play();
|
| 571 |
+
draw();
|
| 572 |
+
}
|
| 573 |
+
}
|
| 574 |
+
|
| 575 |
+
// Move the current piece down (soft drop)
|
| 576 |
+
function moveDown() {
|
| 577 |
+
if (isPaused || gameOver) return;
|
| 578 |
+
|
| 579 |
+
currentPiece.row++;
|
| 580 |
+
if (collision()) {
|
| 581 |
+
currentPiece.row--;
|
| 582 |
+
lockPiece();
|
| 583 |
+
if (soundOn) sounds.drop.play();
|
| 584 |
+
} else {
|
| 585 |
+
draw();
|
| 586 |
+
}
|
| 587 |
+
dropStart = Date.now();
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
// Hard drop - instantly drop the piece
|
| 591 |
+
function hardDrop() {
|
| 592 |
+
if (isPaused || gameOver) return;
|
| 593 |
+
|
| 594 |
+
while (!collision()) {
|
| 595 |
+
currentPiece.row++;
|
| 596 |
+
}
|
| 597 |
+
currentPiece.row--;
|
| 598 |
+
lockPiece();
|
| 599 |
+
if (soundOn) sounds.drop.play();
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
// Lock the piece in place
|
| 603 |
+
function lockPiece() {
|
| 604 |
+
for (let row = 0; row < currentPiece.shape.length; row++) {
|
| 605 |
+
for (let col = 0; col < currentPiece.shape[row].length; col++) {
|
| 606 |
+
if (currentPiece.shape[row][col]) {
|
| 607 |
+
const boardRow = currentPiece.row + row;
|
| 608 |
+
const boardCol = currentPiece.col + col;
|
| 609 |
+
|
| 610 |
+
if (boardRow >= 0) {
|
| 611 |
+
board[boardRow][boardCol] = currentPiece.type;
|
| 612 |
+
}
|
| 613 |
+
}
|
| 614 |
+
}
|
| 615 |
+
}
|
| 616 |
+
|
| 617 |
+
// Check for completed lines
|
| 618 |
+
checkLines();
|
| 619 |
+
|
| 620 |
+
// Spawn new piece
|
| 621 |
+
spawnPiece();
|
| 622 |
+
draw();
|
| 623 |
+
}
|
| 624 |
+
|
| 625 |
+
// Check for completed lines
|
| 626 |
+
function checkLines() {
|
| 627 |
+
let linesCleared = 0;
|
| 628 |
+
|
| 629 |
+
for (let row = ROWS - 1; row >= 0; row--) {
|
| 630 |
+
if (board[row].every(cell => cell !== 0)) {
|
| 631 |
+
// Remove the line
|
| 632 |
+
board.splice(row, 1);
|
| 633 |
+
// Add new empty line at top
|
| 634 |
+
board.unshift(Array(COLS).fill(0));
|
| 635 |
+
linesCleared++;
|
| 636 |
+
row++; // Check the same row again
|
| 637 |
+
}
|
| 638 |
+
}
|
| 639 |
+
|
| 640 |
+
if (linesCleared > 0) {
|
| 641 |
+
lines += linesCleared;
|
| 642 |
+
|
| 643 |
+
// Calculate score
|
| 644 |
+
const linePoints = [0, 40, 100, 300, 1200];
|
| 645 |
+
score += linePoints[linesCleared] * level;
|
| 646 |
+
|
| 647 |
+
// Check for level up
|
| 648 |
+
const newLevel = Math.floor(lines / 10) + 1;
|
| 649 |
+
if (newLevel > level) {
|
| 650 |
+
level = newLevel;
|
| 651 |
+
if (soundOn) sounds.levelUp.play();
|
| 652 |
+
updateDropSpeed();
|
| 653 |
+
}
|
| 654 |
+
|
| 655 |
+
if (soundOn) sounds.clear.play();
|
| 656 |
+
}
|
| 657 |
+
}
|
| 658 |
+
|
| 659 |
+
// Update the drop speed based on level
|
| 660 |
+
function updateDropSpeed() {
|
| 661 |
+
clearInterval(dropInterval);
|
| 662 |
+
const speed = Math.max(100, 1000 - (level - 1) * 100);
|
| 663 |
+
dropInterval = setInterval(moveDown, speed);
|
| 664 |
+
}
|
| 665 |
+
|
| 666 |
+
// Start the game
|
| 667 |
+
function startGame() {
|
| 668 |
+
score = 0;
|
| 669 |
+
level = 1;
|
| 670 |
+
lines = 0;
|
| 671 |
+
gameOver = false;
|
| 672 |
+
board = Array(ROWS).fill().map(() => Array(COLS).fill(0));
|
| 673 |
+
dropStart = Date.now();
|
| 674 |
+
updateDropSpeed();
|
| 675 |
+
gameOverlay.classList.add('hidden');
|
| 676 |
+
}
|
| 677 |
+
|
| 678 |
+
// Pause/unpause the game
|
| 679 |
+
function togglePause() {
|
| 680 |
+
if (gameOver) return;
|
| 681 |
+
|
| 682 |
+
isPaused = !isPaused;
|
| 683 |
+
|
| 684 |
+
if (isPaused) {
|
| 685 |
+
clearInterval(dropInterval);
|
| 686 |
+
pauseBtn.innerHTML = '<i class="fas fa-play mr-2"></i> Resume';
|
| 687 |
+
pauseBtn.classList.remove('bg-amber-600');
|
| 688 |
+
pauseBtn.classList.add('bg-emerald-600');
|
| 689 |
+
} else {
|
| 690 |
+
updateDropSpeed();
|
| 691 |
+
pauseBtn.innerHTML = '<i class="fas fa-pause mr-2"></i> Pause';
|
| 692 |
+
pauseBtn.classList.remove('bg-emerald-600');
|
| 693 |
+
pauseBtn.classList.add('bg-amber-600');
|
| 694 |
+
dropStart = Date.now();
|
| 695 |
+
}
|
| 696 |
+
}
|
| 697 |
+
|
| 698 |
+
// Toggle sound
|
| 699 |
+
function toggleSound() {
|
| 700 |
+
soundOn = !soundOn;
|
| 701 |
+
soundBtn.innerHTML = soundOn
|
| 702 |
+
? '<i class="fas fa-volume-up mr-2"></i> Sound On'
|
| 703 |
+
: '<i class="fas fa-volume-mute mr-2"></i> Sound Off';
|
| 704 |
+
}
|
| 705 |
+
|
| 706 |
+
// Add event listeners
|
| 707 |
+
function addEventListeners() {
|
| 708 |
+
// Keyboard controls
|
| 709 |
+
document.addEventListener('keydown', e => {
|
| 710 |
+
if (e.key === 'ArrowUp') rotate();
|
| 711 |
+
if (e.key === 'ArrowLeft') moveLeft();
|
| 712 |
+
if (e.key === 'ArrowRight') moveRight();
|
| 713 |
+
if (e.key === 'ArrowDown') moveDown();
|
| 714 |
+
if (e.key === ' ') hardDrop();
|
| 715 |
+
if (e.key === 'p') togglePause();
|
| 716 |
+
});
|
| 717 |
+
|
| 718 |
+
// Button controls
|
| 719 |
+
pauseBtn.addEventListener('click', togglePause);
|
| 720 |
+
soundBtn.addEventListener('click', toggleSound);
|
| 721 |
+
restartBtn.addEventListener('click', startGame);
|
| 722 |
+
|
| 723 |
+
// Mobile controls
|
| 724 |
+
rotateBtn.addEventListener('touchstart', (e) => {
|
| 725 |
+
e.preventDefault();
|
| 726 |
+
rotate();
|
| 727 |
+
});
|
| 728 |
+
|
| 729 |
+
leftBtn.addEventListener('touchstart', (e) => {
|
| 730 |
+
e.preventDefault();
|
| 731 |
+
moveLeft();
|
| 732 |
+
});
|
| 733 |
+
|
| 734 |
+
rightBtn.addEventListener('touchstart', (e) => {
|
| 735 |
+
e.preventDefault();
|
| 736 |
+
moveRight();
|
| 737 |
+
});
|
| 738 |
+
|
| 739 |
+
downBtn.addEventListener('touchstart', (e) => {
|
| 740 |
+
e.preventDefault();
|
| 741 |
+
moveDown();
|
| 742 |
+
});
|
| 743 |
+
|
| 744 |
+
hardDropBtn.addEventListener('touchstart', (e) => {
|
| 745 |
+
e.preventDefault();
|
| 746 |
+
hardDrop();
|
| 747 |
+
});
|
| 748 |
+
|
| 749 |
+
// Prevent touch events from scrolling the page
|
| 750 |
+
document.querySelectorAll('.control-btn').forEach(btn => {
|
| 751 |
+
btn.addEventListener('touchstart', (e) => {
|
| 752 |
+
e.preventDefault();
|
| 753 |
+
}, { passive: false });
|
| 754 |
+
});
|
| 755 |
+
}
|
| 756 |
+
|
| 757 |
+
// Start the game
|
| 758 |
+
init();
|
| 759 |
+
</script>
|
| 760 |
+
<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=Eligrgs/goldman" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
|
| 761 |
+
</html>
|
prompts.txt
ADDED
|
File without changes
|