aicoding101 commited on
Commit
2e007a8
ยท
verified ยท
1 Parent(s): ce58224

Add 3 files

Browse files
Files changed (3) hide show
  1. README.md +7 -5
  2. index.html +434 -19
  3. prompts.txt +0 -0
README.md CHANGED
@@ -1,10 +1,12 @@
1
  ---
2
- title: G G
3
- emoji: ๐Ÿ“Š
4
- colorFrom: green
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: g-g
3
+ emoji: ๐Ÿณ
4
+ colorFrom: blue
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,434 @@
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="ko">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>์˜ค๋ชฉ ๊ฒŒ์ž„</title>
7
+ <script src="https://cdn.tailwindcss.com"></script>
8
+ <style>
9
+ body {
10
+ display: flex;
11
+ flex-direction: column;
12
+ align-items: center;
13
+ justify-content: center;
14
+ min-height: 100vh;
15
+ background-color: #f5f5f5;
16
+ font-family: 'Arial', sans-serif;
17
+ }
18
+
19
+ .board {
20
+ display: grid;
21
+ grid-template-columns: repeat(15, 40px);
22
+ grid-template-rows: repeat(15, 40px);
23
+ background-color: #e6c88c;
24
+ border: 2px solid #8b4513;
25
+ position: relative;
26
+ box-shadow: 0 10px 20px rgba(0, 0, 0, 0.2);
27
+ }
28
+
29
+ .cell {
30
+ width: 40px;
31
+ height: 40px;
32
+ border: 1px solid #8b4513;
33
+ display: flex;
34
+ align-items: center;
35
+ justify-content: center;
36
+ position: relative;
37
+ cursor: pointer;
38
+ }
39
+
40
+ .cell:hover {
41
+ background-color: rgba(255, 255, 255, 0.2);
42
+ }
43
+
44
+ .stone {
45
+ width: 30px;
46
+ height: 30px;
47
+ border-radius: 50%;
48
+ position: relative;
49
+ z-index: 1;
50
+ }
51
+
52
+ .black {
53
+ background: radial-gradient(circle at 30% 30%, #666, #000);
54
+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.5);
55
+ }
56
+
57
+ .white {
58
+ background: radial-gradient(circle at 30% 30%, #fff, #ccc);
59
+ box-shadow: 1px 1px 3px rgba(0, 0, 0, 0.3);
60
+ }
61
+
62
+ .star-point {
63
+ position: absolute;
64
+ width: 4px;
65
+ height: 4px;
66
+ background-color: #000;
67
+ border-radius: 50%;
68
+ top: 50%;
69
+ left: 50%;
70
+ transform: translate(-50%, -50%);
71
+ }
72
+
73
+ .controls {
74
+ margin-top: 20px;
75
+ display: flex;
76
+ gap: 15px;
77
+ }
78
+
79
+ .status {
80
+ margin-top: 20px;
81
+ font-size: 1.2rem;
82
+ font-weight: bold;
83
+ color: #333;
84
+ padding: 10px 20px;
85
+ background-color: #fff;
86
+ border-radius: 8px;
87
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
88
+ }
89
+
90
+ button {
91
+ padding: 10px 20px;
92
+ background-color: #4a7c59;
93
+ color: white;
94
+ border: none;
95
+ border-radius: 8px;
96
+ cursor: pointer;
97
+ font-weight: bold;
98
+ transition: all 0.3s;
99
+ box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
100
+ }
101
+
102
+ button:hover {
103
+ background-color: #3a6a49;
104
+ transform: translateY(-2px);
105
+ }
106
+
107
+ .win-line {
108
+ position: absolute;
109
+ background-color: red;
110
+ z-index: 0;
111
+ transform-origin: 0 0;
112
+ }
113
+
114
+ .modal {
115
+ display: none;
116
+ position: fixed;
117
+ top: 0;
118
+ left: 0;
119
+ width: 100%;
120
+ height: 100%;
121
+ background-color: rgba(0, 0, 0, 0.5);
122
+ z-index: 100;
123
+ justify-content: center;
124
+ align-items: center;
125
+ }
126
+
127
+ .modal-content {
128
+ background-color: white;
129
+ padding: 30px;
130
+ border-radius: 10px;
131
+ text-align: center;
132
+ box-shadow: 0 5px 15px rgba(0, 0, 0, 0.3);
133
+ max-width: 400px;
134
+ width: 80%;
135
+ }
136
+
137
+ .modal h2 {
138
+ margin-top: 0;
139
+ color: #4a7c59;
140
+ }
141
+
142
+ .modal button {
143
+ margin-top: 20px;
144
+ background-color: #4a7c59;
145
+ }
146
+ </style>
147
+ </head>
148
+ <body>
149
+ <h1 class="text-3xl font-bold mb-6 text-gray-800">์˜ค๋ชฉ ๊ฒŒ์ž„</h1>
150
+
151
+ <div class="status">ํ‘๋Œ ์ฐจ๋ก€</div>
152
+
153
+ <div class="board" id="board"></div>
154
+
155
+ <div class="controls">
156
+ <button id="restart">๊ฒŒ์ž„ ๋‹ค์‹œํ•˜๊ธฐ</button>
157
+ <button id="undo">๋ฌด๋ฅด๊ธฐ</button>
158
+ </div>
159
+
160
+ <div class="modal" id="modal">
161
+ <div class="modal-content">
162
+ <h2 id="modal-title">๊ฒŒ์ž„ ์ข…๋ฃŒ</h2>
163
+ <p id="modal-message">ํ‘๋Œ์ด ์Šน๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค!</p>
164
+ <button id="modal-button">ํ™•์ธ</button>
165
+ </div>
166
+ </div>
167
+
168
+ <script>
169
+ document.addEventListener('DOMContentLoaded', () => {
170
+ const board = document.getElementById('board');
171
+ const statusDisplay = document.querySelector('.status');
172
+ const restartButton = document.getElementById('restart');
173
+ const undoButton = document.getElementById('undo');
174
+ const modal = document.getElementById('modal');
175
+ const modalTitle = document.getElementById('modal-title');
176
+ const modalMessage = document.getElementById('modal-message');
177
+ const modalButton = document.getElementById('modal-button');
178
+
179
+ // ๊ฒŒ์ž„ ์ƒํƒœ
180
+ let gameState = Array(15).fill().map(() => Array(15).fill(null));
181
+ let currentPlayer = 'black';
182
+ let gameActive = true;
183
+ let moveHistory = [];
184
+
185
+ // ์Šน๋ฆฌ ๋ผ์ธ์„ ์ €์žฅํ•  ๋ณ€์ˆ˜
186
+ let winLine = null;
187
+
188
+ // ๋ณด๋“œ ์ดˆ๊ธฐํ™”
189
+ function initializeBoard() {
190
+ board.innerHTML = '';
191
+
192
+ // ๋ณด๋“œ ์ƒ์„ฑ
193
+ for (let i = 0; i < 15; i++) {
194
+ for (let j = 0; j < 15; j++) {
195
+ const cell = document.createElement('div');
196
+ cell.classList.add('cell');
197
+ cell.dataset.row = i;
198
+ cell.dataset.col = j;
199
+
200
+ // ๋ณ„ ํ‘œ์‹œ (์˜ค๋ชฉํŒ์˜ ํŠน์ • ์œ„์น˜์—)
201
+ if ((i === 3 || i === 7 || i === 11) && (j === 3 || j === 7 || j === 11)) {
202
+ const star = document.createElement('div');
203
+ star.classList.add('star-point');
204
+ cell.appendChild(star);
205
+ }
206
+
207
+ cell.addEventListener('click', () => handleCellClick(i, j));
208
+ board.appendChild(cell);
209
+ }
210
+ }
211
+
212
+ // ๊ธฐ์กด ์Šน๋ฆฌ ๋ผ์ธ ์ œ๊ฑฐ
213
+ if (winLine) {
214
+ winLine.remove();
215
+ winLine = null;
216
+ }
217
+ }
218
+
219
+ // ์…€ ํด๋ฆญ ์ฒ˜๋ฆฌ
220
+ function handleCellClick(row, col) {
221
+ if (!gameActive || gameState[row][col] !== null) return;
222
+
223
+ // ๋Œ ๋†“๊ธฐ
224
+ placeStone(row, col, currentPlayer);
225
+
226
+ // ๊ฒŒ์ž„ ์ƒํƒœ ์—…๋ฐ์ดํŠธ
227
+ gameState[row][col] = currentPlayer;
228
+ moveHistory.push({row, col, player: currentPlayer});
229
+
230
+ // ์Šน๋ฆฌ ํ™•์ธ
231
+ if (checkWin(row, col)) {
232
+ gameActive = false;
233
+ showWinner(currentPlayer);
234
+ return;
235
+ }
236
+
237
+ // ๋ฌด์Šน๋ถ€ ํ™•์ธ
238
+ if (checkDraw()) {
239
+ gameActive = false;
240
+ showDraw();
241
+ return;
242
+ }
243
+
244
+ // ํ”Œ๋ ˆ์ด์–ด ๋ณ€๊ฒฝ
245
+ currentPlayer = currentPlayer === 'black' ? 'white' : 'black';
246
+ updateStatus();
247
+ }
248
+
249
+ // ๋Œ ๋†“๊ธฐ
250
+ function placeStone(row, col, player) {
251
+ const cell = document.querySelector(`.cell[data-row="${row}"][data-col="${col}"]`);
252
+ const stone = document.createElement('div');
253
+ stone.classList.add('stone', player);
254
+ cell.appendChild(stone);
255
+ }
256
+
257
+ // ์Šน๋ฆฌ ํ™•์ธ
258
+ function checkWin(row, col) {
259
+ const directions = [
260
+ [0, 1], // ๊ฐ€๋กœ
261
+ [1, 0], // ์„ธ๋กœ
262
+ [1, 1], // ๋Œ€๊ฐ์„  โ†˜
263
+ [1, -1] // ๋Œ€๊ฐ์„  โ†™
264
+ ];
265
+
266
+ for (const [dx, dy] of directions) {
267
+ let count = 1;
268
+
269
+ // ํ•œ ๋ฐฉํ–ฅ์œผ๋กœ ๊ฒ€์‚ฌ
270
+ count += countStones(row, col, dx, dy);
271
+ // ๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ์œผ๋กœ ๊ฒ€์‚ฌ
272
+ count += countStones(row, col, -dx, -dy);
273
+
274
+ if (count >= 5) {
275
+ drawWinLine(row, col, dx, dy);
276
+ return true;
277
+ }
278
+ }
279
+
280
+ return false;
281
+ }
282
+
283
+ // ์—ฐ์†๋œ ๋Œ ๊ฐœ์ˆ˜ ์„ธ๊ธฐ
284
+ function countStones(row, col, dx, dy) {
285
+ const player = gameState[row][col];
286
+ let count = 0;
287
+ let r = row + dx;
288
+ let c = col + dy;
289
+
290
+ while (r >= 0 && r < 15 && c >= 0 && c < 15 && gameState[r][c] === player) {
291
+ count++;
292
+ r += dx;
293
+ c += dy;
294
+ }
295
+
296
+ return count;
297
+ }
298
+
299
+ // ์Šน๋ฆฌ ๋ผ์ธ ๊ทธ๋ฆฌ๊ธฐ
300
+ function drawWinLine(row, col, dx, dy) {
301
+ // ๋จผ์ € ์Šน๋ฆฌํ•œ ๋Œ์˜ ์œ„์น˜๋ฅผ ์ฐพ๊ธฐ ์œ„ํ•ด ์–‘์ชฝ์œผ๋กœ ๊ฒ€์‚ฌ
302
+ let startRow = row;
303
+ let startCol = col;
304
+ let endRow = row;
305
+ let endCol = col;
306
+
307
+ const player = gameState[row][col];
308
+
309
+ // ์‹œ์ž‘์  ์ฐพ๊ธฐ (๋ฐ˜๋Œ€ ๋ฐฉํ–ฅ)
310
+ while (startRow - dx >= 0 && startRow - dx < 15 &&
311
+ startCol - dy >= 0 && startCol - dy < 15 &&
312
+ gameState[startRow - dx][startCol - dy] === player) {
313
+ startRow -= dx;
314
+ startCol -= dy;
315
+ }
316
+
317
+ // ๋์  ์ฐพ๊ธฐ (์ฃผ์–ด์ง„ ๋ฐฉํ–ฅ)
318
+ while (endRow + dx >= 0 && endRow + dx < 15 &&
319
+ endCol + dy >= 0 && endCol + dy < 15 &&
320
+ gameState[endRow + dx][endCol + dy] === player) {
321
+ endRow += dx;
322
+ endCol += dy;
323
+ }
324
+
325
+ // ์‹œ์ž‘์ ๊ณผ ๋์ ์˜ ์‹ค์ œ ์ขŒํ‘œ ๊ณ„์‚ฐ
326
+ const startCell = document.querySelector(`.cell[data-row="${startRow}"][data-col="${startCol}"]`);
327
+ const endCell = document.querySelector(`.cell[data-row="${endRow}"][data-col="${endCol}"]`);
328
+
329
+ const startRect = startCell.getBoundingClientRect();
330
+ const endRect = endCell.getBoundingClientRect();
331
+
332
+ const boardRect = board.getBoundingClientRect();
333
+
334
+ // ๋ณด๋“œ ์ƒ๋Œ€ ์ขŒํ‘œ ๊ณ„์‚ฐ
335
+ const startX = startRect.left + startRect.width / 2 - boardRect.left;
336
+ const startY = startRect.top + startRect.height / 2 - boardRect.top;
337
+ const endX = endRect.left + endRect.width / 2 - boardRect.left;
338
+ const endY = endRect.top + endRect.height / 2 - boardRect.top;
339
+
340
+ // ๋ผ์ธ ๊ธธ์ด ๊ณ„์‚ฐ
341
+ const length = Math.sqrt(Math.pow(endX - startX, 2) + Math.pow(endY - startY, 2));
342
+
343
+ // ๋ผ์ธ ๊ฐ๋„ ๊ณ„์‚ฐ
344
+ const angle = Math.atan2(endY - startY, endX - startX);
345
+
346
+ // ๋ผ์ธ ์ƒ์„ฑ
347
+ winLine = document.createElement('div');
348
+ winLine.classList.add('win-line');
349
+ winLine.style.width = `${length}px`;
350
+ winLine.style.height = '3px';
351
+ winLine.style.left = `${startX}px`;
352
+ winLine.style.top = `${startY}px`;
353
+ winLine.style.transform = `rotate(${angle}rad)`;
354
+
355
+ board.appendChild(winLine);
356
+ }
357
+
358
+ // ๋ฌด์Šน๋ถ€ ํ™•์ธ
359
+ function checkDraw() {
360
+ return gameState.every(row => row.every(cell => cell !== null));
361
+ }
362
+
363
+ // ์Šน์ž ํ‘œ์‹œ
364
+ function showWinner(player) {
365
+ const winner = player === 'black' ? 'ํ‘๋Œ' : '๋ฐฑ๋Œ';
366
+ modalTitle.textContent = '๊ฒŒ์ž„ ์ข…๋ฃŒ';
367
+ modalMessage.textContent = `${winner}์ด(๊ฐ€) ์Šน๋ฆฌํ–ˆ์Šต๋‹ˆ๋‹ค!`;
368
+ modal.style.display = 'flex';
369
+ }
370
+
371
+ // ๋ฌด์Šน๋ถ€ ํ‘œ์‹œ
372
+ function showDraw() {
373
+ modalTitle.textContent = '๊ฒŒ์ž„ ์ข…๋ฃŒ';
374
+ modalMessage.textContent = '๋ฌด์Šน๋ถ€์ž…๋‹ˆ๋‹ค!';
375
+ modal.style.display = 'flex';
376
+ }
377
+
378
+ // ์ƒํƒœ ์—…๋ฐ์ดํŠธ
379
+ function updateStatus() {
380
+ const player = currentPlayer === 'black' ? 'ํ‘๋Œ' : '๋ฐฑ๋Œ';
381
+ statusDisplay.textContent = `${player} ์ฐจ๋ก€`;
382
+ }
383
+
384
+ // ๊ฒŒ์ž„ ๋ฆฌ์…‹
385
+ function resetGame() {
386
+ gameState = Array(15).fill().map(() => Array(15).fill(null));
387
+ currentPlayer = 'black';
388
+ gameActive = true;
389
+ moveHistory = [];
390
+ initializeBoard();
391
+ updateStatus();
392
+ modal.style.display = 'none';
393
+ }
394
+
395
+ // ๋ฌด๋ฅด๊ธฐ ๊ธฐ๋Šฅ
396
+ function undoMove() {
397
+ if (moveHistory.length === 0 || !gameActive) return;
398
+
399
+ const lastMove = moveHistory.pop();
400
+ gameState[lastMove.row][lastMove.col] = null;
401
+
402
+ const cell = document.querySelector(`.cell[data-row="${lastMove.row}"][data-col="${lastMove.col}"]`);
403
+ cell.innerHTML = '';
404
+ if ((lastMove.row === 3 || lastMove.row === 7 || lastMove.row === 11) &&
405
+ (lastMove.col === 3 || lastMove.col === 7 || lastMove.col === 11)) {
406
+ const star = document.createElement('div');
407
+ star.classList.add('star-point');
408
+ cell.appendChild(star);
409
+ }
410
+
411
+ currentPlayer = lastMove.player;
412
+ updateStatus();
413
+
414
+ // ์Šน๋ฆฌ ๋ผ์ธ ์ œ๊ฑฐ
415
+ if (winLine) {
416
+ winLine.remove();
417
+ winLine = null;
418
+ }
419
+ }
420
+
421
+ // ์ด๋ฒคํŠธ ๋ฆฌ์Šค๋„ˆ
422
+ restartButton.addEventListener('click', resetGame);
423
+ undoButton.addEventListener('click', undoMove);
424
+ modalButton.addEventListener('click', () => {
425
+ modal.style.display = 'none';
426
+ resetGame();
427
+ });
428
+
429
+ // ๊ฒŒ์ž„ ์‹œ์ž‘
430
+ initializeBoard();
431
+ });
432
+ </script>
433
+ <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=aicoding101/g-g" style="color: #fff;text-decoration: underline;" target="_blank" >Remix</a></p></body>
434
+ </html>
prompts.txt ADDED
File without changes