Gerfeson commited on
Commit
bb916fa
·
verified ·
1 Parent(s): ef94d0b

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +620 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Teris
3
- emoji: 🏆
4
- colorFrom: blue
5
- colorTo: gray
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: teris
3
+ emoji: 🐳
4
+ colorFrom: pink
5
+ colorTo: purple
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,620 @@
1
- <!doctype html>
2
- <html>
3
- <head>
4
- <meta charset="utf-8" />
5
- <meta name="viewport" content="width=device-width" />
6
- <title>My static Space</title>
7
- <link rel="stylesheet" href="style.css" />
8
- </head>
9
- <body>
10
- <div class="card">
11
- <h1>Welcome to your static Space!</h1>
12
- <p>You can modify this app directly by editing <i>index.html</i> in the Files and versions tab.</p>
13
- <p>
14
- Also don't forget to check the
15
- <a href="https://huggingface.co/docs/hub/spaces" target="_blank">Spaces documentation</a>.
16
- </p>
17
- </div>
18
- </body>
19
- </html>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="pt-br">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Tetris Moderno</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
+ @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
11
+
12
+ .tetris-font {
13
+ font-family: 'Press Start 2P', cursive;
14
+ }
15
+
16
+ .game-board {
17
+ background: rgba(255, 255, 255, 0.05);
18
+ border-radius: 10px;
19
+ box-shadow: 0 0 20px rgba(0, 255, 255, 0.2);
20
+ border: 2px solid rgba(0, 255, 255, 0.3);
21
+ }
22
+
23
+ .cell {
24
+ width: 30px;
25
+ height: 30px;
26
+ border: 1px solid rgba(255, 255, 255, 0.05);
27
+ box-sizing: border-box;
28
+ }
29
+
30
+ .piece-I { background-color: #00f0f0; box-shadow: inset 0 0 10px rgba(0, 240, 240, 0.8); }
31
+ .piece-J { background-color: #0000f0; box-shadow: inset 0 0 10px rgba(0, 0, 240, 0.8); }
32
+ .piece-L { background-color: #f0a000; box-shadow: inset 0 0 10px rgba(240, 160, 0, 0.8); }
33
+ .piece-O { background-color: #f0f000; box-shadow: inset 0 0 10px rgba(240, 240, 0, 0.8); }
34
+ .piece-S { background-color: #00f000; box-shadow: inset 0 0 10px rgba(0, 240, 0, 0.8); }
35
+ .piece-T { background-color: #a000f0; box-shadow: inset 0 0 10px rgba(160, 0, 240, 0.8); }
36
+ .piece-Z { background-color: #f00000; box-shadow: inset 0 0 10px rgba(240, 0, 0, 0.8); }
37
+
38
+ .glow {
39
+ animation: glow 1.5s ease-in-out infinite alternate;
40
+ }
41
+
42
+ @keyframes glow {
43
+ from {
44
+ box-shadow: 0 0 5px #fff, 0 0 10px #fff, 0 0 15px #00f0f0, 0 0 20px #00f0f0;
45
+ }
46
+ to {
47
+ box-shadow: 0 0 10px #fff, 0 0 20px #fff, 0 0 30px #00f0f0, 0 0 40px #00f0f0;
48
+ }
49
+ }
50
+
51
+ .next-piece-container {
52
+ background: rgba(0, 0, 0, 0.3);
53
+ border-radius: 8px;
54
+ padding: 10px;
55
+ border: 1px solid rgba(0, 255, 255, 0.2);
56
+ }
57
+ </style>
58
+ </head>
59
+ <body class="bg-gray-900 text-white min-h-screen flex flex-col items-center justify-center p-4">
60
+ <div class="max-w-4xl w-full">
61
+ <h1 class="text-4xl md:text-5xl font-bold text-center mb-6 tetris-font glow">
62
+ <span class="text-cyan-400">T</span>
63
+ <span class="text-blue-500">E</span>
64
+ <span class="text-yellow-400">T</span>
65
+ <span class="text-green-500">R</span>
66
+ <span class="text-purple-500">I</span>
67
+ <span class="text-red-500">S</span>
68
+ </h1>
69
+
70
+ <div class="flex flex-col md:flex-row items-center justify-center gap-8">
71
+ <!-- Game Board -->
72
+ <div class="game-board relative">
73
+ <canvas id="tetris" width="300" height="600" class="rounded-lg"></canvas>
74
+
75
+ <!-- Game Over Overlay -->
76
+ <div id="gameOverOverlay" class="absolute inset-0 bg-black bg-opacity-70 flex flex-col items-center justify-center hidden rounded-lg">
77
+ <h2 class="text-3xl font-bold mb-4 text-red-500 tetris-font">GAME OVER</h2>
78
+ <p id="finalScore" class="text-xl mb-6 tetris-font">Score: 0</p>
79
+ <button id="restartButton" class="px-6 py-3 bg-cyan-500 hover:bg-cyan-600 rounded-lg font-bold tetris-font transition-all">
80
+ PLAY AGAIN
81
+ </button>
82
+ </div>
83
+
84
+ <!-- Pause Overlay -->
85
+ <div id="pauseOverlay" class="absolute inset-0 bg-black bg-opacity-70 flex flex-col items-center justify-center hidden rounded-lg">
86
+ <h2 class="text-3xl font-bold mb-4 text-yellow-400 tetris-font">PAUSED</h2>
87
+ <button id="resumeButton" class="px-6 py-3 bg-green-500 hover:bg-green-600 rounded-lg font-bold tetris-font transition-all">
88
+ RESUME
89
+ </button>
90
+ </div>
91
+ </div>
92
+
93
+ <!-- Game Info -->
94
+ <div class="flex flex-col gap-6 w-full md:w-64">
95
+ <!-- Score -->
96
+ <div class="bg-gray-800 p-4 rounded-lg border border-cyan-400">
97
+ <h3 class="text-lg font-semibold text-cyan-400 mb-2 tetris-font">SCORE</h3>
98
+ <p id="score" class="text-2xl font-bold tetris-font">0</p>
99
+ </div>
100
+
101
+ <!-- Level -->
102
+ <div class="bg-gray-800 p-4 rounded-lg border border-purple-500">
103
+ <h3 class="text-lg font-semibold text-purple-500 mb-2 tetris-font">LEVEL</h3>
104
+ <p id="level" class="text-2xl font-bold tetris-font">1</p>
105
+ </div>
106
+
107
+ <!-- Lines -->
108
+ <div class="bg-gray-800 p-4 rounded-lg border border-green-500">
109
+ <h3 class="text-lg font-semibold text-green-500 mb-2 tetris-font">LINES</h3>
110
+ <p id="lines" class="text-2xl font-bold tetris-font">0</p>
111
+ </div>
112
+
113
+ <!-- Next Piece -->
114
+ <div class="bg-gray-800 p-4 rounded-lg border border-yellow-400 next-piece-container">
115
+ <h3 class="text-lg font-semibold text-yellow-400 mb-2 tetris-font">NEXT</h3>
116
+ <canvas id="nextPiece" width="120" height="120" class="mx-auto"></canvas>
117
+ </div>
118
+
119
+ <!-- Controls -->
120
+ <div class="bg-gray-800 p-4 rounded-lg border border-red-500">
121
+ <h3 class="text-lg font-semibold text-red-500 mb-3 tetris-font">CONTROLS</h3>
122
+ <div class="grid grid-cols-3 gap-2 text-center">
123
+ <div class="p-2 bg-gray-700 rounded">
124
+ <i class="fas fa-arrow-up"></i>
125
+ <p class="text-xs mt-1">Rotate</p>
126
+ </div>
127
+ <div class="p-2 bg-gray-700 rounded">
128
+ <i class="fas fa-arrow-down"></i>
129
+ <p class="text-xs mt-1">Speed</p>
130
+ </div>
131
+ <div class="p-2 bg-gray-700 rounded">
132
+ <i class="fas fa-arrow-right"></i>
133
+ <p class="text-xs mt-1">Right</p>
134
+ </div>
135
+ <div class="p-2 bg-gray-700 rounded col-span-3">
136
+ <i class="fas fa-arrow-left"></i>
137
+ <p class="text-xs mt-1">Left</p>
138
+ </div>
139
+ <div class="p-2 bg-gray-700 rounded col-span-3">
140
+ <i class="fas fa-space-shuttle"></i>
141
+ <p class="text-xs mt-1">Hard Drop</p>
142
+ </div>
143
+ <div class="p-2 bg-gray-700 rounded col-span-3">
144
+ <i class="fas fa-pause"></i>
145
+ <p class="text-xs mt-1">Pause</p>
146
+ </div>
147
+ </div>
148
+ </div>
149
+ </div>
150
+ </div>
151
+
152
+ <!-- Mobile Controls -->
153
+ <div class="mt-8 md:hidden">
154
+ <div class="grid grid-cols-3 gap-2">
155
+ <button id="moveLeft" class="p-4 bg-blue-600 rounded-lg">
156
+ <i class="fas fa-arrow-left text-2xl"></i>
157
+ </button>
158
+ <button id="rotate" class="p-4 bg-purple-600 rounded-lg">
159
+ <i class="fas fa-redo text-2xl"></i>
160
+ </button>
161
+ <button id="moveRight" class="p-4 bg-blue-600 rounded-lg">
162
+ <i class="fas fa-arrow-right text-2xl"></i>
163
+ </button>
164
+ <button id="softDrop" class="p-4 bg-green-600 rounded-lg col-span-2">
165
+ <i class="fas fa-arrow-down text-2xl"></i>
166
+ </button>
167
+ <button id="hardDrop" class="p-4 bg-red-600 rounded-lg">
168
+ <i class="fas fa-arrow-circle-down text-2xl"></i>
169
+ </button>
170
+ </div>
171
+ </div>
172
+ </div>
173
+
174
+ <script>
175
+ document.addEventListener('DOMContentLoaded', () => {
176
+ // Game elements
177
+ const canvas = document.getElementById('tetris');
178
+ const ctx = canvas.getContext('2d');
179
+ const nextPieceCanvas = document.getElementById('nextPiece');
180
+ const nextPieceCtx = nextPieceCanvas.getContext('2d');
181
+
182
+ // UI elements
183
+ const scoreElement = document.getElementById('score');
184
+ const levelElement = document.getElementById('level');
185
+ const linesElement = document.getElementById('lines');
186
+ const gameOverOverlay = document.getElementById('gameOverOverlay');
187
+ const pauseOverlay = document.getElementById('pauseOverlay');
188
+ const finalScoreElement = document.getElementById('finalScore');
189
+ const restartButton = document.getElementById('restartButton');
190
+ const resumeButton = document.getElementById('resumeButton');
191
+
192
+ // Mobile controls
193
+ const moveLeftBtn = document.getElementById('moveLeft');
194
+ const moveRightBtn = document.getElementById('moveRight');
195
+ const rotateBtn = document.getElementById('rotate');
196
+ const softDropBtn = document.getElementById('softDrop');
197
+ const hardDropBtn = document.getElementById('hardDrop');
198
+
199
+ // Game settings
200
+ const scale = 30;
201
+ const rows = 20;
202
+ const cols = 10;
203
+ let score = 0;
204
+ let level = 1;
205
+ let lines = 0;
206
+ let gameOver = false;
207
+ let isPaused = false;
208
+ let dropCounter = 0;
209
+ let dropInterval = 1000;
210
+ let lastTime = 0;
211
+
212
+ // Board matrix
213
+ const board = Array.from(Array(rows), () => Array(cols).fill(0));
214
+
215
+ // Pieces
216
+ const pieces = [
217
+ { shape: [[0, 0, 0, 0], [1, 1, 1, 1], [0, 0, 0, 0], [0, 0, 0, 0]], className: 'piece-I' }, // I
218
+ { shape: [[2, 0, 0], [2, 2, 2], [0, 0, 0]], className: 'piece-J' }, // J
219
+ { shape: [[0, 0, 3], [3, 3, 3], [0, 0, 0]], className: 'piece-L' }, // L
220
+ { shape: [[4, 4], [4, 4]], className: 'piece-O' }, // O
221
+ { shape: [[0, 5, 5], [5, 5, 0], [0, 0, 0]], className: 'piece-S' }, // S
222
+ { shape: [[0, 6, 0], [6, 6, 6], [0, 0, 0]], className: 'piece-T' }, // T
223
+ { shape: [[7, 7, 0], [0, 7, 7], [0, 0, 0]], className: 'piece-Z' } // Z
224
+ ];
225
+
226
+ // Current and next piece
227
+ let player = {
228
+ pos: {x: 0, y: 0},
229
+ matrix: null,
230
+ pieceClass: ''
231
+ };
232
+
233
+ let nextPiece = {
234
+ matrix: null,
235
+ pieceClass: ''
236
+ };
237
+
238
+ // Initialize game
239
+ function init() {
240
+ // Reset game state
241
+ score = 0;
242
+ level = 1;
243
+ lines = 0;
244
+ gameOver = false;
245
+ isPaused = false;
246
+ dropInterval = 1000;
247
+
248
+ // Clear board
249
+ for (let y = 0; y < rows; y++) {
250
+ for (let x = 0; x < cols; x++) {
251
+ board[y][x] = 0;
252
+ }
253
+ }
254
+
255
+ // Update UI
256
+ updateScore();
257
+ updateLevel();
258
+ updateLines();
259
+
260
+ // Hide overlays
261
+ gameOverOverlay.classList.add('hidden');
262
+ pauseOverlay.classList.add('hidden');
263
+
264
+ // Create first pieces
265
+ resetPlayer();
266
+ createNextPiece();
267
+
268
+ // Start game loop
269
+ lastTime = 0;
270
+ requestAnimationFrame(update);
271
+ }
272
+
273
+ // Game loop
274
+ function update(time = 0) {
275
+ if (gameOver || isPaused) return;
276
+
277
+ const deltaTime = time - lastTime;
278
+ lastTime = time;
279
+
280
+ dropCounter += deltaTime;
281
+ if (dropCounter > dropInterval) {
282
+ playerDrop();
283
+ dropCounter = 0;
284
+ }
285
+
286
+ draw();
287
+ drawNextPiece();
288
+ requestAnimationFrame(update);
289
+ }
290
+
291
+ // Draw game
292
+ function draw() {
293
+ // Clear canvas
294
+ ctx.fillStyle = 'rgba(0, 0, 0, 0.1)';
295
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
296
+
297
+ // Draw board
298
+ drawMatrix(board, {x: 0, y: 0}, 'board');
299
+
300
+ // Draw player piece
301
+ drawMatrix(player.matrix, player.pos, player.pieceClass);
302
+
303
+ // Draw grid
304
+ ctx.strokeStyle = 'rgba(255, 255, 255, 0.05)';
305
+ ctx.lineWidth = 0.5;
306
+
307
+ for (let y = 0; y < rows; y++) {
308
+ for (let x = 0; x < cols; x++) {
309
+ ctx.strokeRect(x * scale, y * scale, scale, scale);
310
+ }
311
+ }
312
+ }
313
+
314
+ // Draw next piece preview
315
+ function drawNextPiece() {
316
+ // Clear canvas
317
+ nextPieceCtx.fillStyle = 'rgba(0, 0, 0, 0)';
318
+ nextPieceCtx.fillRect(0, 0, nextPieceCanvas.width, nextPieceCanvas.height);
319
+
320
+ // Center the piece
321
+ const offsetX = (nextPieceCanvas.width - nextPiece.matrix[0].length * scale / 2.5) / 2;
322
+ const offsetY = (nextPieceCanvas.height - nextPiece.matrix.length * scale / 2.5) / 2;
323
+
324
+ // Draw next piece
325
+ for (let y = 0; y < nextPiece.matrix.length; y++) {
326
+ for (let x = 0; x < nextPiece.matrix[y].length; x++) {
327
+ if (nextPiece.matrix[y][x] !== 0) {
328
+ nextPieceCtx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue(`--color-${nextPiece.pieceClass.split('-')[1].toLowerCase()}`) || '#fff';
329
+ nextPieceCtx.fillRect(
330
+ offsetX + x * (scale / 2.5),
331
+ offsetY + y * (scale / 2.5),
332
+ scale / 2.5 - 1,
333
+ scale / 2.5 - 1
334
+ );
335
+
336
+ // Add glow effect
337
+ nextPieceCtx.shadowColor = getComputedStyle(document.documentElement).getPropertyValue(`--color-${nextPiece.pieceClass.split('-')[1].toLowerCase()}`) || '#fff';
338
+ nextPieceCtx.shadowBlur = 10;
339
+ }
340
+ }
341
+ }
342
+ }
343
+
344
+ // Draw matrix (board or piece)
345
+ function drawMatrix(matrix, offset, className) {
346
+ matrix.forEach((row, y) => {
347
+ row.forEach((value, x) => {
348
+ if (value !== 0) {
349
+ if (className === 'board') {
350
+ // For board cells, use the stored class
351
+ const pieceClasses = ['', 'piece-I', 'piece-J', 'piece-L', 'piece-O', 'piece-S', 'piece-T', 'piece-Z'];
352
+ ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue(`--color-${pieceClasses[value].split('-')[1].toLowerCase()}`) || '#fff';
353
+ } else {
354
+ // For current piece, use its class
355
+ ctx.fillStyle = getComputedStyle(document.documentElement).getPropertyValue(`--color-${className.split('-')[1].toLowerCase()}`) || '#fff';
356
+ }
357
+
358
+ ctx.fillRect(
359
+ (offset.x + x) * scale,
360
+ (offset.y + y) * scale,
361
+ scale - 1,
362
+ scale - 1
363
+ );
364
+
365
+ // Add inner glow
366
+ ctx.shadowColor = ctx.fillStyle;
367
+ ctx.shadowBlur = 10;
368
+ }
369
+ });
370
+ });
371
+ }
372
+
373
+ // Merge player piece with board
374
+ function merge() {
375
+ player.matrix.forEach((row, y) => {
376
+ row.forEach((value, x) => {
377
+ if (value !== 0) {
378
+ board[y + player.pos.y][x + player.pos.x] = value;
379
+ }
380
+ });
381
+ });
382
+ }
383
+
384
+ // Rotate player piece
385
+ function playerRotate() {
386
+ if (gameOver || isPaused) return;
387
+
388
+ const pos = player.pos.x;
389
+ let offset = 1;
390
+ rotate(player.matrix);
391
+
392
+ while (collide()) {
393
+ player.pos.x += offset;
394
+ offset = -(offset + (offset > 0 ? 1 : -1));
395
+
396
+ if (offset > player.matrix[0].length) {
397
+ rotate(player.matrix);
398
+ player.pos.x = pos;
399
+ return;
400
+ }
401
+ }
402
+ }
403
+
404
+ // Rotate matrix
405
+ function rotate(matrix) {
406
+ const N = matrix.length;
407
+
408
+ // Transpose matrix
409
+ for (let y = 0; y < N; y++) {
410
+ for (let x = 0; x < y; x++) {
411
+ [matrix[x][y], matrix[y][x]] = [matrix[y][x], matrix[x][y]];
412
+ }
413
+ }
414
+
415
+ // Reverse each row
416
+ for (let y = 0; y < N; y++) {
417
+ matrix[y].reverse();
418
+ }
419
+ }
420
+
421
+ // Move player left
422
+ function playerMove(dir) {
423
+ if (gameOver || isPaused) return;
424
+
425
+ player.pos.x += dir;
426
+ if (collide()) {
427
+ player.pos.x -= dir;
428
+ }
429
+ }
430
+
431
+ // Move player down (soft drop)
432
+ function playerDrop() {
433
+ if (gameOver || isPaused) return;
434
+
435
+ player.pos.y++;
436
+ if (collide()) {
437
+ player.pos.y--;
438
+ merge();
439
+ resetPlayer();
440
+ arenaSweep();
441
+ }
442
+ dropCounter = 0;
443
+ }
444
+
445
+ // Hard drop
446
+ function playerHardDrop() {
447
+ if (gameOver || isPaused) return;
448
+
449
+ while (!collide()) {
450
+ player.pos.y++;
451
+ }
452
+ player.pos.y--;
453
+ merge();
454
+ resetPlayer();
455
+ arenaSweep();
456
+ }
457
+
458
+ // Check for collisions
459
+ function collide() {
460
+ const [m, o] = [player.matrix, player.pos];
461
+
462
+ for (let y = 0; y < m.length; y++) {
463
+ for (let x = 0; x < m[y].length; x++) {
464
+ if (m[y][x] !== 0 &&
465
+ (board[y + o.y] === undefined ||
466
+ board[y + o.y][x + o.x] === undefined ||
467
+ board[y + o.y][x + o.x] !== 0)) {
468
+ return true;
469
+ }
470
+ }
471
+ }
472
+ return false;
473
+ }
474
+
475
+ // Check for completed lines
476
+ function arenaSweep() {
477
+ let linesCleared = 0;
478
+
479
+ outer: for (let y = board.length - 1; y >= 0; y--) {
480
+ for (let x = 0; x < board[y].length; x++) {
481
+ if (board[y][x] === 0) {
482
+ continue outer;
483
+ }
484
+ }
485
+
486
+ // Remove the line
487
+ const row = board.splice(y, 1)[0].fill(0);
488
+ board.unshift(row);
489
+ y++;
490
+
491
+ linesCleared++;
492
+ }
493
+
494
+ if (linesCleared > 0) {
495
+ // Update score
496
+ const linePoints = [0, 40, 100, 300, 1200];
497
+ score += linePoints[linesCleared] * level;
498
+ lines += linesCleared;
499
+
500
+ // Update level (every 10 lines)
501
+ level = Math.floor(lines / 10) + 1;
502
+
503
+ // Increase speed
504
+ dropInterval = Math.max(100, 1000 - (level - 1) * 100);
505
+
506
+ updateScore();
507
+ updateLevel();
508
+ updateLines();
509
+ }
510
+ }
511
+
512
+ // Reset player with next piece
513
+ function resetPlayer() {
514
+ // Set current piece to next piece
515
+ if (nextPiece.matrix) {
516
+ player.matrix = nextPiece.matrix;
517
+ player.pieceClass = nextPiece.pieceClass;
518
+ } else {
519
+ // First piece
520
+ const randomPiece = pieces[Math.floor(Math.random() * pieces.length)];
521
+ player.matrix = randomPiece.shape;
522
+ player.pieceClass = randomPiece.className;
523
+ }
524
+
525
+ // Reset position
526
+ player.pos.y = 0;
527
+ player.pos.x = Math.floor(cols / 2) - Math.floor(player.matrix[0].length / 2);
528
+
529
+ // Game over if collision at spawn
530
+ if (collide()) {
531
+ gameOver = true;
532
+ finalScoreElement.textContent = `Score: ${score}`;
533
+ gameOverOverlay.classList.remove('hidden');
534
+ }
535
+
536
+ // Create new next piece
537
+ createNextPiece();
538
+ }
539
+
540
+ // Create next piece
541
+ function createNextPiece() {
542
+ const randomPiece = pieces[Math.floor(Math.random() * pieces.length)];
543
+ nextPiece.matrix = randomPiece.shape;
544
+ nextPiece.pieceClass = randomPiece.className;
545
+ }
546
+
547
+ // Update score display
548
+ function updateScore() {
549
+ scoreElement.textContent = score;
550
+ }
551
+
552
+ // Update level display
553
+ function updateLevel() {
554
+ levelElement.textContent = level;
555
+ }
556
+
557
+ // Update lines display
558
+ function updateLines() {
559
+ linesElement.textContent = lines;
560
+ }
561
+
562
+ // Pause game
563
+ function togglePause() {
564
+ if (gameOver) return;
565
+
566
+ isPaused = !isPaused;
567
+
568
+ if (isPaused) {
569
+ pauseOverlay.classList.remove('hidden');
570
+ } else {
571
+ pauseOverlay.classList.add('hidden');
572
+ lastTime = performance.now();
573
+ dropCounter = 0;
574
+ requestAnimationFrame(update);
575
+ }
576
+ }
577
+
578
+ // Event listeners
579
+ document.addEventListener('keydown', event => {
580
+ if (event.key === 'ArrowLeft') {
581
+ playerMove(-1);
582
+ } else if (event.key === 'ArrowRight') {
583
+ playerMove(1);
584
+ } else if (event.key === 'ArrowDown') {
585
+ playerDrop();
586
+ } else if (event.key === 'ArrowUp') {
587
+ playerRotate();
588
+ } else if (event.key === ' ') {
589
+ playerHardDrop();
590
+ } else if (event.key === 'p' || event.key === 'P') {
591
+ togglePause();
592
+ }
593
+ });
594
+
595
+ // Mobile controls
596
+ moveLeftBtn.addEventListener('click', () => playerMove(-1));
597
+ moveRightBtn.addEventListener('click', () => playerMove(1));
598
+ rotateBtn.addEventListener('click', () => playerRotate());
599
+ softDropBtn.addEventListener('click', () => playerDrop());
600
+ hardDropBtn.addEventListener('click', () => playerHardDrop());
601
+
602
+ // UI buttons
603
+ restartButton.addEventListener('click', init);
604
+ resumeButton.addEventListener('click', togglePause);
605
+
606
+ // Start game
607
+ init();
608
+
609
+ // Add CSS variables for piece colors
610
+ document.documentElement.style.setProperty('--color-i', '#00f0f0');
611
+ document.documentElement.style.setProperty('--color-j', '#0000f0');
612
+ document.documentElement.style.setProperty('--color-l', '#f0a000');
613
+ document.documentElement.style.setProperty('--color-o', '#f0f000');
614
+ document.documentElement.style.setProperty('--color-s', '#00f000');
615
+ document.documentElement.style.setProperty('--color-t', '#a000f0');
616
+ document.documentElement.style.setProperty('--color-z', '#f00000');
617
+ });
618
+ </script>
619
+ <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=Gerfeson/teris" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
620
+ </html>
prompts.txt ADDED
File without changes