chakkale commited on
Commit
4a3a9fd
·
verified ·
1 Parent(s): 570cabe

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +6 -4
  2. index.html +483 -19
  3. prompts.txt +1 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Neonsnake
3
- emoji: 📉
4
  colorFrom: green
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: neonsnake
3
+ emoji: 🐳
4
  colorFrom: green
5
+ colorTo: yellow
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,483 @@
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="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>Neon Cyberpunk Snake</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ @import url('https://fonts.googleapis.com/css2?family=Press+Start+2P&display=swap');
10
+
11
+ body {
12
+ background-color: #0f0f1a;
13
+ font-family: 'Press Start 2P', cursive;
14
+ overflow: hidden;
15
+ color: #00f7ff;
16
+ }
17
+
18
+ .game-container {
19
+ position: relative;
20
+ border: 4px solid #ff00f7;
21
+ box-shadow: 0 0 20px #ff00f7,
22
+ inset 0 0 20px #ff00f7;
23
+ border-radius: 5px;
24
+ }
25
+
26
+ .snake {
27
+ background-color: #00f7ff;
28
+ box-shadow: 0 0 10px #00f7ff;
29
+ border-radius: 2px;
30
+ }
31
+
32
+ .food {
33
+ background-color: #ff00f7;
34
+ box-shadow: 0 0 10px #ff00f7;
35
+ border-radius: 50%;
36
+ animation: pulse 0.5s infinite alternate;
37
+ }
38
+
39
+ @keyframes pulse {
40
+ 0% {
41
+ transform: scale(1);
42
+ opacity: 1;
43
+ }
44
+ 100% {
45
+ transform: scale(1.2);
46
+ opacity: 0.8;
47
+ }
48
+ }
49
+
50
+ .neon-text {
51
+ text-shadow: 0 0 5px #00f7ff,
52
+ 0 0 10px #00f7ff,
53
+ 0 0 15px #00f7ff;
54
+ }
55
+
56
+ .neon-pink {
57
+ text-shadow: 0 0 5px #ff00f7,
58
+ 0 0 10px #ff00f7,
59
+ 0 0 15px #ff00f7;
60
+ }
61
+
62
+ .grid-line {
63
+ border: 1px solid rgba(0, 247, 255, 0.1);
64
+ }
65
+
66
+ .scanline {
67
+ position: absolute;
68
+ top: 0;
69
+ left: 0;
70
+ width: 100%;
71
+ height: 100%;
72
+ background: linear-gradient(to bottom,
73
+ rgba(0, 247, 255, 0) 0%,
74
+ rgba(0, 247, 255, 0.1) 50%,
75
+ rgba(0, 247, 255, 0) 100%);
76
+ background-size: 100% 8px;
77
+ pointer-events: none;
78
+ animation: scan 3s linear infinite;
79
+ }
80
+
81
+ @keyframes scan {
82
+ 0% {
83
+ background-position: 0 0;
84
+ }
85
+ 100% {
86
+ background-position: 0 100%;
87
+ }
88
+ }
89
+
90
+ .glitch {
91
+ position: relative;
92
+ }
93
+
94
+ .glitch::before, .glitch::after {
95
+ content: attr(data-text);
96
+ position: absolute;
97
+ top: 0;
98
+ left: 0;
99
+ width: 100%;
100
+ height: 100%;
101
+ background: #0f0f1a;
102
+ }
103
+
104
+ .glitch::before {
105
+ left: 2px;
106
+ text-shadow: -2px 0 #ff00f7;
107
+ clip-path: polygon(0 20%, 100% 20%, 100% 30%, 0 30%);
108
+ animation: glitch-anim 2s infinite linear alternate-reverse;
109
+ }
110
+
111
+ .glitch::after {
112
+ left: -2px;
113
+ text-shadow: 2px 0 #00f7ff;
114
+ clip-path: polygon(0 60%, 100% 60%, 100% 70%, 0 70%);
115
+ animation: glitch-anim 1.5s infinite linear alternate-reverse;
116
+ }
117
+
118
+ @keyframes glitch-anim {
119
+ 0% {
120
+ transform: translate(0);
121
+ }
122
+ 20% {
123
+ transform: translate(-3px, 3px);
124
+ }
125
+ 40% {
126
+ transform: translate(-3px, -3px);
127
+ }
128
+ 60% {
129
+ transform: translate(3px, 3px);
130
+ }
131
+ 80% {
132
+ transform: translate(3px, -3px);
133
+ }
134
+ 100% {
135
+ transform: translate(0);
136
+ }
137
+ }
138
+
139
+ .btn-neon {
140
+ background: transparent;
141
+ border: 2px solid #00f7ff;
142
+ color: #00f7ff;
143
+ padding: 10px 20px;
144
+ font-family: 'Press Start 2P', cursive;
145
+ font-size: 12px;
146
+ cursor: pointer;
147
+ transition: all 0.3s;
148
+ box-shadow: 0 0 10px #00f7ff;
149
+ position: relative;
150
+ overflow: hidden;
151
+ }
152
+
153
+ .btn-neon:hover {
154
+ background: #00f7ff;
155
+ color: #0f0f1a;
156
+ box-shadow: 0 0 20px #00f7ff;
157
+ }
158
+
159
+ .btn-neon::before {
160
+ content: '';
161
+ position: absolute;
162
+ top: 0;
163
+ left: -100%;
164
+ width: 100%;
165
+ height: 100%;
166
+ background: linear-gradient(90deg, transparent, rgba(0, 247, 255, 0.4), transparent);
167
+ transition: 0.5s;
168
+ }
169
+
170
+ .btn-neon:hover::before {
171
+ left: 100%;
172
+ }
173
+ </style>
174
+ </head>
175
+ <body class="min-h-screen flex flex-col items-center justify-center p-4">
176
+ <div class="text-center mb-6">
177
+ <h1 class="glitch neon-text text-4xl md:text-5xl mb-2" data-text="NEON SNAKE">NEON SNAKE</h1>
178
+ <p class="neon-pink text-sm">CYBERPUNK EDITION</p>
179
+ </div>
180
+
181
+ <div class="relative">
182
+ <div class="game-container">
183
+ <canvas id="gameCanvas" class="bg-black"></canvas>
184
+ <div class="scanline"></div>
185
+ </div>
186
+
187
+ <div id="gameOver" class="hidden absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-80">
188
+ <h2 class="neon-text text-3xl mb-6">GAME OVER</h2>
189
+ <p id="finalScore" class="neon-pink text-xl mb-6">SCORE: 0</p>
190
+ <button id="restartBtn" class="btn-neon">RESTART</button>
191
+ </div>
192
+
193
+ <div id="startScreen" class="absolute inset-0 flex flex-col items-center justify-center bg-black bg-opacity-80">
194
+ <h2 class="neon-text text-3xl mb-6">NEON SNAKE</h2>
195
+ <p class="neon-pink text-sm mb-8">USE ARROW KEYS TO MOVE</p>
196
+ <button id="startBtn" class="btn-neon">START GAME</button>
197
+ </div>
198
+ </div>
199
+
200
+ <div class="mt-6 flex justify-between w-full max-w-md">
201
+ <div class="text-center">
202
+ <p class="neon-text text-sm">SCORE</p>
203
+ <p id="score" class="neon-pink text-2xl">0</p>
204
+ </div>
205
+ <div class="text-center">
206
+ <p class="neon-text text-sm">HIGH SCORE</p>
207
+ <p id="highScore" class="neon-pink text-2xl">0</p>
208
+ </div>
209
+ </div>
210
+
211
+ <div class="mt-6 grid grid-cols-4 gap-4">
212
+ <button id="upBtn" class="btn-neon py-2">↑</button>
213
+ <button id="leftBtn" class="btn-neon py-2">←</button>
214
+ <button id="downBtn" class="btn-neon py-2">↓</button>
215
+ <button id="rightBtn" class="btn-neon py-2">→</button>
216
+ </div>
217
+
218
+ <script>
219
+ document.addEventListener('DOMContentLoaded', () => {
220
+ const canvas = document.getElementById('gameCanvas');
221
+ const ctx = canvas.getContext('2d');
222
+ const startScreen = document.getElementById('startScreen');
223
+ const gameOverScreen = document.getElementById('gameOver');
224
+ const startBtn = document.getElementById('startBtn');
225
+ const restartBtn = document.getElementById('restartBtn');
226
+ const scoreDisplay = document.getElementById('score');
227
+ const highScoreDisplay = document.getElementById('highScore');
228
+ const finalScoreDisplay = document.getElementById('finalScore');
229
+
230
+ // Mobile controls
231
+ const upBtn = document.getElementById('upBtn');
232
+ const downBtn = document.getElementById('downBtn');
233
+ const leftBtn = document.getElementById('leftBtn');
234
+ const rightBtn = document.getElementById('rightBtn');
235
+
236
+ // Game settings
237
+ const gridSize = 20;
238
+ const tileCount = 20;
239
+ let speed = 7;
240
+
241
+ // Game state
242
+ let snake = [];
243
+ let food = {};
244
+ let direction = 'right';
245
+ let nextDirection = 'right';
246
+ let score = 0;
247
+ let highScore = localStorage.getItem('highScore') || 0;
248
+ let gameRunning = false;
249
+ let gameLoop;
250
+
251
+ // Set canvas size
252
+ canvas.width = gridSize * tileCount;
253
+ canvas.height = gridSize * tileCount;
254
+
255
+ // Initialize game
256
+ function initGame() {
257
+ snake = [
258
+ {x: 10, y: 10},
259
+ {x: 9, y: 10},
260
+ {x: 8, y: 10}
261
+ ];
262
+
263
+ spawnFood();
264
+ direction = 'right';
265
+ nextDirection = 'right';
266
+ score = 0;
267
+ scoreDisplay.textContent = score;
268
+ highScoreDisplay.textContent = highScore;
269
+ gameRunning = true;
270
+ }
271
+
272
+ // Spawn food at random position
273
+ function spawnFood() {
274
+ food = {
275
+ x: Math.floor(Math.random() * tileCount),
276
+ y: Math.floor(Math.random() * tileCount)
277
+ };
278
+
279
+ // Make sure food doesn't spawn on snake
280
+ for (let segment of snake) {
281
+ if (segment.x === food.x && segment.y === food.y) {
282
+ return spawnFood();
283
+ }
284
+ }
285
+ }
286
+
287
+ // Main game loop
288
+ function gameUpdate() {
289
+ // Move snake
290
+ const head = {x: snake[0].x, y: snake[0].y};
291
+
292
+ direction = nextDirection;
293
+
294
+ switch(direction) {
295
+ case 'up':
296
+ head.y--;
297
+ break;
298
+ case 'down':
299
+ head.y++;
300
+ break;
301
+ case 'left':
302
+ head.x--;
303
+ break;
304
+ case 'right':
305
+ head.x++;
306
+ break;
307
+ }
308
+
309
+ // Check collision with walls
310
+ if (head.x < 0 || head.x >= tileCount || head.y < 0 || head.y >= tileCount) {
311
+ gameOver();
312
+ return;
313
+ }
314
+
315
+ // Check collision with self
316
+ for (let i = 0; i < snake.length; i++) {
317
+ if (head.x === snake[i].x && head.y === snake[i].y) {
318
+ gameOver();
319
+ return;
320
+ }
321
+ }
322
+
323
+ // Check if snake ate food
324
+ if (head.x === food.x && head.y === food.y) {
325
+ // Don't remove tail
326
+ score++;
327
+ scoreDisplay.textContent = score;
328
+
329
+ // Increase speed every 5 points
330
+ if (score % 5 === 0) {
331
+ speed += 0.5;
332
+ }
333
+
334
+ spawnFood();
335
+ } else {
336
+ // Remove tail
337
+ snake.pop();
338
+ }
339
+
340
+ // Add new head
341
+ snake.unshift(head);
342
+
343
+ // Draw everything
344
+ draw();
345
+ }
346
+
347
+ // Draw game
348
+ function draw() {
349
+ // Clear canvas
350
+ ctx.fillStyle = '#0f0f1a';
351
+ ctx.fillRect(0, 0, canvas.width, canvas.height);
352
+
353
+ // Draw grid
354
+ ctx.strokeStyle = 'rgba(0, 247, 255, 0.1)';
355
+ ctx.lineWidth = 1;
356
+
357
+ for (let i = 0; i < tileCount; i++) {
358
+ // Vertical lines
359
+ ctx.beginPath();
360
+ ctx.moveTo(i * gridSize, 0);
361
+ ctx.lineTo(i * gridSize, canvas.height);
362
+ ctx.stroke();
363
+
364
+ // Horizontal lines
365
+ ctx.beginPath();
366
+ ctx.moveTo(0, i * gridSize);
367
+ ctx.lineTo(canvas.width, i * gridSize);
368
+ ctx.stroke();
369
+ }
370
+
371
+ // Draw snake
372
+ for (let segment of snake) {
373
+ ctx.fillStyle = '#00f7ff';
374
+ ctx.fillRect(segment.x * gridSize, segment.y * gridSize, gridSize, gridSize);
375
+
376
+ // Add glow effect
377
+ ctx.shadowColor = '#00f7ff';
378
+ ctx.shadowBlur = 10;
379
+ ctx.fillRect(segment.x * gridSize, segment.y * gridSize, gridSize, gridSize);
380
+ ctx.shadowBlur = 0;
381
+ }
382
+
383
+ // Draw head with different color
384
+ const head = snake[0];
385
+ ctx.fillStyle = '#00ffaa';
386
+ ctx.fillRect(head.x * gridSize, head.y * gridSize, gridSize, gridSize);
387
+ ctx.shadowColor = '#00ffaa';
388
+ ctx.shadowBlur = 15;
389
+ ctx.fillRect(head.x * gridSize, head.y * gridSize, gridSize, gridSize);
390
+ ctx.shadowBlur = 0;
391
+
392
+ // Draw food
393
+ ctx.fillStyle = '#ff00f7';
394
+ ctx.beginPath();
395
+ ctx.arc(
396
+ food.x * gridSize + gridSize / 2,
397
+ food.y * gridSize + gridSize / 2,
398
+ gridSize / 2,
399
+ 0,
400
+ Math.PI * 2
401
+ );
402
+ ctx.fill();
403
+
404
+ // Add glow effect
405
+ ctx.shadowColor = '#ff00f7';
406
+ ctx.shadowBlur = 15;
407
+ ctx.fill();
408
+ ctx.shadowBlur = 0;
409
+ }
410
+
411
+ // Game over
412
+ function gameOver() {
413
+ gameRunning = false;
414
+ clearInterval(gameLoop);
415
+
416
+ // Update high score
417
+ if (score > highScore) {
418
+ highScore = score;
419
+ localStorage.setItem('highScore', highScore);
420
+ highScoreDisplay.textContent = highScore;
421
+ }
422
+
423
+ finalScoreDisplay.textContent = `SCORE: ${score}`;
424
+ gameOverScreen.classList.remove('hidden');
425
+ }
426
+
427
+ // Start game
428
+ function startGame() {
429
+ startScreen.classList.add('hidden');
430
+ gameOverScreen.classList.add('hidden');
431
+ initGame();
432
+ draw();
433
+
434
+ gameLoop = setInterval(gameUpdate, 1000 / speed);
435
+ }
436
+
437
+ // Event listeners
438
+ startBtn.addEventListener('click', startGame);
439
+ restartBtn.addEventListener('click', startGame);
440
+
441
+ // Keyboard controls
442
+ document.addEventListener('keydown', (e) => {
443
+ if (!gameRunning) return;
444
+
445
+ switch(e.key) {
446
+ case 'ArrowUp':
447
+ if (direction !== 'down') nextDirection = 'up';
448
+ break;
449
+ case 'ArrowDown':
450
+ if (direction !== 'up') nextDirection = 'down';
451
+ break;
452
+ case 'ArrowLeft':
453
+ if (direction !== 'right') nextDirection = 'left';
454
+ break;
455
+ case 'ArrowRight':
456
+ if (direction !== 'left') nextDirection = 'right';
457
+ break;
458
+ }
459
+ });
460
+
461
+ // Mobile controls
462
+ upBtn.addEventListener('click', () => {
463
+ if (gameRunning && direction !== 'down') nextDirection = 'up';
464
+ });
465
+
466
+ downBtn.addEventListener('click', () => {
467
+ if (gameRunning && direction !== 'up') nextDirection = 'down';
468
+ });
469
+
470
+ leftBtn.addEventListener('click', () => {
471
+ if (gameRunning && direction !== 'right') nextDirection = 'left';
472
+ });
473
+
474
+ rightBtn.addEventListener('click', () => {
475
+ if (gameRunning && direction !== 'left') nextDirection = 'right';
476
+ });
477
+
478
+ // Initial draw
479
+ draw();
480
+ });
481
+ </script>
482
+ <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=chakkale/neonsnake" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
483
+ </html>
prompts.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ make a neon cyberpunk styled classic snake game