royam0820 commited on
Commit
ee8e9c9
·
verified ·
1 Parent(s): 26f814f

Add 2 files

Browse files
Files changed (2) hide show
  1. README.md +6 -4
  2. index.html +413 -19
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: Royam0820 Space
3
- emoji: 😻
4
  colorFrom: yellow
5
- colorTo: indigo
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: royam0820-space
3
+ emoji: 🐳
4
  colorFrom: yellow
5
+ colorTo: blue
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,413 @@
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>Retro Pong</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: #0f172a;
13
+ overflow: hidden;
14
+ font-family: 'Press Start 2P', cursive;
15
+ }
16
+
17
+ .game-container {
18
+ position: relative;
19
+ width: 100vw;
20
+ height: 100vh;
21
+ display: flex;
22
+ justify-content: center;
23
+ align-items: center;
24
+ }
25
+
26
+ .paddle {
27
+ position: absolute;
28
+ width: 15px;
29
+ background: linear-gradient(to bottom, #f43f5e, #f97316);
30
+ border-radius: 8px;
31
+ box-shadow: 0 0 10px #f43f5e, 0 0 20px #f43f5e;
32
+ }
33
+
34
+ .ball {
35
+ position: absolute;
36
+ width: 15px;
37
+ height: 15px;
38
+ background: linear-gradient(45deg, #f43f5e, #3b82f6);
39
+ border-radius: 50%;
40
+ box-shadow: 0 0 10px #3b82f6, 0 0 20px #f43f5e;
41
+ }
42
+
43
+ .score {
44
+ color: #f1f5f9;
45
+ text-shadow: 0 0 5px #3b82f6, 0 0 10px #3b82f6;
46
+ font-size: 2rem;
47
+ position: absolute;
48
+ top: 20px;
49
+ }
50
+
51
+ .center-line {
52
+ position: absolute;
53
+ width: 2px;
54
+ height: 100%;
55
+ background-color: rgba(255, 255, 255, 0.1);
56
+ left: 50%;
57
+ transform: translateX(-50%);
58
+ display: flex;
59
+ flex-direction: column;
60
+ justify-content: space-around;
61
+ }
62
+
63
+ .dashed-line {
64
+ height: 30px;
65
+ width: 2px;
66
+ background-color: rgba(255, 255, 255, 0.3);
67
+ margin: 10px 0;
68
+ }
69
+
70
+ .game-border {
71
+ position: absolute;
72
+ border: 2px dashed rgba(255, 255, 255, 0.3);
73
+ width: 98%;
74
+ height: 96%;
75
+ }
76
+
77
+ .neon-text {
78
+ color: #f1f5f9;
79
+ text-shadow: 0 0 5px #f43f5e, 0 0 10px #f43f5e;
80
+ }
81
+
82
+ .start-screen, .game-over-screen {
83
+ position: absolute;
84
+ top: 0;
85
+ left: 0;
86
+ width: 100%;
87
+ height: 100%;
88
+ display: flex;
89
+ flex-direction: column;
90
+ justify-content: center;
91
+ align-items: center;
92
+ background-color: rgba(0, 0, 0, 0.8);
93
+ z-index: 10;
94
+ }
95
+
96
+ .start-button {
97
+ background: linear-gradient(to bottom, #f43f5e, #3b82f6);
98
+ border: none;
99
+ padding: 15px 30px;
100
+ margin-top: 30px;
101
+ color: white;
102
+ font-family: 'Press Start 2P', cursive;
103
+ font-size: 1rem;
104
+ border-radius: 5px;
105
+ cursor: pointer;
106
+ transition: all 0.3s;
107
+ box-shadow: 0 0 10px #3b82f6, 0 0 20px #f43f5e;
108
+ }
109
+
110
+ .start-button:hover {
111
+ transform: scale(1.1);
112
+ box-shadow: 0 0 20px #3b82f6, 0 0 40px #f43f5e;
113
+ }
114
+ </style>
115
+ </head>
116
+ <body>
117
+ <div class="game-container">
118
+ <div class="game-border"></div>
119
+ <div class="center-line">
120
+ <div class="dashed-line"></div>
121
+ <div class="dashed-line"></div>
122
+ <div class="dashed-line"></div>
123
+ <div class="dashed-line"></div>
124
+ <div class="dashed-line"></div>
125
+ </div>
126
+
127
+ <div id="playerScore" class="score left-1/3">0</div>
128
+ <div id="aiScore" class="score right-1/3">0</div>
129
+
130
+ <div id="playerPaddle" class="paddle left-4" style="height: 80px;"></div>
131
+ <div id="aiPaddle" class="paddle right-4" style="height: 80px;"></div>
132
+ <div id="ball" class="ball"></div>
133
+
134
+ <div id="startScreen" class="start-screen">
135
+ <h1 class="text-4xl md:text-6xl neon-text mb-6">RETRO PONG</h1>
136
+ <p class="text-xl neon-text mb-10">Use ↑ ↓ arrow keys to move your paddle</p>
137
+ <button id="startButton" class="start-button">START GAME</button>
138
+ </div>
139
+
140
+ <div id="gameOverScreen" class="game-over-screen hidden">
141
+ <h1 id="gameOverText" class="text-4xl md:text-6xl neon-text mb-6">GAME OVER</h1>
142
+ <p id="finalScore" class="text-xl neon-text mb-10">Score: 0 - 0</p>
143
+ <button id="restartButton" class="start-button">PLAY AGAIN</button>
144
+ </div>
145
+ </div>
146
+
147
+ <script>
148
+ document.addEventListener('DOMContentLoaded', () => {
149
+ // Game elements
150
+ const gameContainer = document.querySelector('.game-container');
151
+ const playerPaddle = document.getElementById('playerPaddle');
152
+ const aiPaddle = document.getElementById('aiPaddle');
153
+ const ball = document.getElementById('ball');
154
+ const playerScoreDisplay = document.getElementById('playerScore');
155
+ const aiScoreDisplay = document.getElementById('aiScore');
156
+ const startScreen = document.getElementById('startScreen');
157
+ const gameOverScreen = document.getElementById('gameOverScreen');
158
+ const startButton = document.getElementById('startButton');
159
+ const restartButton = document.getElementById('restartButton');
160
+ const gameOverText = document.getElementById('gameOverText');
161
+ const finalScore = document.getElementById('finalScore');
162
+
163
+ // Game variables
164
+ let gameWidth = gameContainer.offsetWidth;
165
+ let gameHeight = gameContainer.offsetHeight;
166
+ let paddleHeight = 80;
167
+ let paddleWidth = 15;
168
+ let ballSize = 15;
169
+ let playerScore = 0;
170
+ let aiScore = 0;
171
+ let gameRunning = false;
172
+ let animationId;
173
+
174
+ // Ball properties
175
+ let ballX = gameWidth / 2;
176
+ let ballY = gameHeight / 2;
177
+ let ballSpeedX = 5;
178
+ let ballSpeedY = 5;
179
+
180
+ // Paddle properties
181
+ let playerPaddleY = gameHeight / 2 - paddleHeight / 2;
182
+ let aiPaddleY = gameHeight / 2 - paddleHeight / 2;
183
+ let paddleSpeed = 8;
184
+
185
+ // Event listeners for buttons
186
+ startButton.addEventListener('click', startGame);
187
+ restartButton.addEventListener('click', startGame);
188
+
189
+ // Initialize paddle and ball positions
190
+ function initPositions() {
191
+ playerPaddleY = gameHeight / 2 - paddleHeight / 2;
192
+ aiPaddleY = gameHeight / 2 - paddleHeight / 2;
193
+ ballX = gameWidth / 2;
194
+ ballY = gameHeight / 2;
195
+
196
+ // Randomize ball direction
197
+ ballSpeedX = Math.random() > 0.5 ? 5 : -5;
198
+ ballSpeedY = (Math.random() * 4 - 2);
199
+
200
+ updatePositions();
201
+ }
202
+
203
+ // Update displayed positions
204
+ function updatePositions() {
205
+ playerPaddle.style.top = `${playerPaddleY}px`;
206
+ aiPaddle.style.top = `${aiPaddleY}px`;
207
+ ball.style.left = `${ballX}px`;
208
+ ball.style.top = `${ballY}px`;
209
+ }
210
+
211
+ // Reset game
212
+ function resetGame() {
213
+ playerScore = 0;
214
+ aiScore = 0;
215
+ updateScore();
216
+ initPositions();
217
+ }
218
+
219
+ // Update score display
220
+ function updateScore() {
221
+ playerScoreDisplay.textContent = playerScore;
222
+ aiScoreDisplay.textContent = aiScore;
223
+ }
224
+
225
+ // Game loop
226
+ function gameLoop() {
227
+ if (!gameRunning) return;
228
+
229
+ // Move ball
230
+ ballX += ballSpeedX;
231
+ ballY += ballSpeedY;
232
+
233
+ // Ball collision with top and bottom walls
234
+ if (ballY <= 0 || ballY + ballSize >= gameHeight) {
235
+ ballSpeedY = -ballSpeedY;
236
+
237
+ // Add some visual effect
238
+ document.body.style.backgroundColor = '#1e293b';
239
+ setTimeout(() => {
240
+ document.body.style.backgroundColor = '#0f172a';
241
+ }, 50);
242
+ }
243
+
244
+ // Ball collision with paddles
245
+ // Player paddle
246
+ if (
247
+ ballX <= paddleWidth + 20 &&
248
+ ballY + ballSize >= playerPaddleY &&
249
+ ballY <= playerPaddleY + paddleHeight
250
+ ) {
251
+ ballX = paddleWidth + 20;
252
+ ballSpeedX = -ballSpeedX * 1.05; // Increase speed slightly
253
+
254
+ // Change angle based on where ball hits paddle
255
+ let deltaY = (ballY - (playerPaddleY + paddleHeight / 2)) / (paddleHeight / 2);
256
+ ballSpeedY = deltaY * 6;
257
+
258
+ // Add visual effect
259
+ playerPaddle.style.boxShadow = '0 0 15px #f43f5e, 0 0 30px #f43f5e';
260
+ setTimeout(() => {
261
+ playerPaddle.style.boxShadow = '0 0 10px #f43f5e, 0 0 20px #f43f5e';
262
+ }, 100);
263
+ }
264
+
265
+ // AI paddle
266
+ if (
267
+ ballX + ballSize >= gameWidth - paddleWidth - 20 &&
268
+ ballY + ballSize >= aiPaddleY &&
269
+ ballY <= aiPaddleY + paddleHeight
270
+ ) {
271
+ ballX = gameWidth - paddleWidth - 20 - ballSize;
272
+ ballSpeedX = -ballSpeedX * 1.05; // Increase speed slightly
273
+
274
+ // Change angle based on where ball hits paddle
275
+ let deltaY = (ballY - (aiPaddleY + paddleHeight / 2)) / (paddleHeight / 2);
276
+ ballSpeedY = deltaY * 6;
277
+
278
+ // Add visual effect
279
+ aiPaddle.style.boxShadow = '0 0 15px #f43f5e, 0 0 30px #f43f5e';
280
+ setTimeout(() => {
281
+ aiPaddle.style.boxShadow = '0 0 10px #f43f5e, 0 0 20px #f43f5e';
282
+ }, 100);
283
+ }
284
+
285
+ // Ball out of bounds - score points
286
+ if (ballX + ballSize < 0) {
287
+ // AI scores
288
+ aiScore++;
289
+ updateScore();
290
+
291
+ if (aiScore >= 5) {
292
+ endGame(false);
293
+ } else {
294
+ initPositions();
295
+ }
296
+ } else if (ballX > gameWidth) {
297
+ // Player scores
298
+ playerScore++;
299
+ updateScore();
300
+
301
+ if (playerScore >= 5) {
302
+ endGame(true);
303
+ } else {
304
+ initPositions();
305
+ }
306
+ }
307
+
308
+ // AI paddle movement (simple tracking)
309
+ let aiPaddleCenter = aiPaddleY + paddleHeight / 2;
310
+ if (aiPaddleCenter < ballY - 10) {
311
+ aiPaddleY += 5 * Math.min(1, Math.abs(ballSpeedY / 6)) * (ballSpeedX > 0 ? 1 : 0.5);
312
+ } else if (aiPaddleCenter > ballY + 10) {
313
+ aiPaddleY -= 5 * Math.min(1, Math.abs(ballSpeedY / 6)) * (ballSpeedX > 0 ? 1 : 0.5);
314
+ }
315
+
316
+ // Keep paddles in bounds
317
+ if (playerPaddleY < 0) playerPaddleY = 0;
318
+ if (playerPaddleY > gameHeight - paddleHeight) playerPaddleY = gameHeight - paddleHeight;
319
+
320
+ if (aiPaddleY < 0) aiPaddleY = 0;
321
+ if (aiPaddleY > gameHeight - paddleHeight) aiPaddleY = gameHeight - paddleHeight;
322
+
323
+ // Update visual positions
324
+ updatePositions();
325
+
326
+ // Continue game loop
327
+ animationId = requestAnimationFrame(gameLoop);
328
+ }
329
+
330
+ // Handle keyboard input
331
+ const keysPressed = {};
332
+
333
+ document.addEventListener('keydown', (e) => {
334
+ keysPressed[e.key] = true;
335
+
336
+ // Prevent default for arrow keys to avoid page scrolling
337
+ if (e.key === 'ArrowUp' || e.key === 'ArrowDown') {
338
+ e.preventDefault();
339
+ }
340
+ });
341
+
342
+ document.addEventListener('keyup', (e) => {
343
+ keysPressed[e.key] = false;
344
+ });
345
+
346
+ // Handle paddle movement
347
+ function handlePaddleMovement() {
348
+ if (keysPressed['ArrowUp'] && playerPaddleY > 0) {
349
+ playerPaddleY -= paddleSpeed;
350
+ }
351
+ if (keysPressed['ArrowDown'] && playerPaddleY < gameHeight - paddleHeight) {
352
+ playerPaddleY += paddleSpeed;
353
+ }
354
+ }
355
+
356
+ // Start the game
357
+ function startGame() {
358
+ gameRunning = true;
359
+ startScreen.classList.add('hidden');
360
+ gameOverScreen.classList.add('hidden');
361
+ resetGame();
362
+
363
+ // Handle screen resize
364
+ window.addEventListener('resize', handleResize);
365
+ handleResize();
366
+
367
+ // Start the game loop
368
+ animationId = requestAnimationFrame(gameLoop);
369
+
370
+ // Start the input handling loop
371
+ setInterval(handlePaddleMovement, 1000/60);
372
+ }
373
+
374
+ // End the game
375
+ function endGame(playerWon) {
376
+ gameRunning = false;
377
+ cancelAnimationFrame(animationId);
378
+
379
+ gameOverText.textContent = playerWon ? 'YOU WIN!' : 'GAME OVER';
380
+ gameOverText.style.textShadow = playerWon ? '0 0 5px #3b82f6, 0 0 10px #3b82f6' : '0 0 5px #f43f5e, 0 0 10px #f43f5e';
381
+
382
+ finalScore.textContent = `Score: ${playerScore} - ${aiScore}`;
383
+
384
+ gameOverScreen.classList.remove('hidden');
385
+ }
386
+
387
+ // Handle window resize
388
+ function handleResize() {
389
+ gameWidth = gameContainer.offsetWidth;
390
+ gameHeight = gameContainer.offsetHeight;
391
+
392
+ // Reset positions on resize
393
+ initPositions();
394
+ }
395
+
396
+ // Set up glow effects for paddles
397
+ setInterval(() => {
398
+ if (gameRunning) {
399
+ const colors = ['#f43f5e', '#3b82f6', '#f59e0b', '#10b981'];
400
+ const randomColor1 = colors[Math.floor(Math.random() * colors.length)];
401
+ const randomColor2 = colors[Math.floor(Math.random() * colors.length)];
402
+
403
+ playerPaddle.style.background = `linear-gradient(to bottom, ${randomColor1}, ${randomColor2})`;
404
+ aiPaddle.style.background = `linear-gradient(to bottom, ${randomColor2}, ${randomColor1})`;
405
+ }
406
+ }, 2000);
407
+
408
+ // Initial setup
409
+ initPositions();
410
+ });
411
+ </script>
412
+ <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=royam0820/royam0820-space" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
413
+ </html>