commit ce9af4ffcdb89397e6a8a1af7db44052d5121088
Author: root <root@hub.scroll.pub> Date: 2024-12-29 01:29:47 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..0808523 --- /dev/null +++ b/body.html @@ -0,0 +1,10 @@ +<header> + <h1>Candy Swap</h1> + <div class="score">Score: <span id="score">0</span></div> +</header> +<main> + <div id="game-board"></div> +</main> +<footer> + <p>Match 3 or more candies to score points!</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..55f13d5 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://candyswap.scroll.pub +metaTags +editButton /edit.html +title Candy Swap - A Simple Candy Crush Clone +style.css +body.html +script.js \ No newline at end of file diff --git a/prompt.json b/prompt.json new file mode 100644 index 0000000..0290a5c --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "665a49df-ff9f-4960-86d9-5ba9354357ac", + "object": "chat.completion", + "created": 1735435773, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\ncandyswap.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://candyswap.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Candy Swap - A Simple Candy Crush Clone\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Candy Swap</h1>\n <div class=\"score\">Score: <span id=\"score\">0</span></div>\n</header>\n<main>\n <div id=\"game-board\"></div>\n</main>\n<footer>\n <p>Match 3 or more candies to score points!</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #ff6f61;\n --secondary-color: #ffcc5c;\n --background-color: #f4f4f4;\n --text-color: #333;\n --cell-size: 60px;\n}\n\n* {\n margin: 0;\n padding: 0;\n box-sizing: border-box;\n}\n\nbody {\n font-family: 'Arial', sans-serif;\n background-color: var(--background-color);\n color: var(--text-color);\n min-height: 100vh;\n display: flex;\n flex-direction: column;\n align-items: center;\n padding: 20px;\n}\n\nheader {\n text-align: center;\n margin-bottom: 20px;\n}\n\nh1 {\n color: var(--primary-color);\n font-size: 2.5rem;\n margin-bottom: 10px;\n}\n\n.score {\n font-size: 1.2rem;\n font-weight: bold;\n}\n\n#game-board {\n display: grid;\n grid-template-columns: repeat(8, var(--cell-size));\n grid-template-rows: repeat(8, var(--cell-size));\n gap: 5px;\n background-color: white;\n padding: 10px;\n border-radius: 10px;\n box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);\n}\n\n.cell {\n width: var(--cell-size);\n height: var(--cell-size);\n border-radius: 10px;\n cursor: pointer;\n transition: transform 0.2s ease;\n}\n\n.cell:hover {\n transform: scale(1.1);\n}\n\nfooter {\n margin-top: 20px;\n text-align: center;\n font-size: 0.9rem;\n color: #666;\n}\n\n@media (max-width: 600px) {\n :root {\n --cell-size: 40px;\n }\n\n h1 {\n font-size: 2rem;\n }\n}\n---script.js---\nconst colors = ['#ff6f61', '#ffcc5c', '#88d8b0', '#96ceb4', '#ffeead'];\nconst boardSize = 8;\nlet score = 0;\nlet board = [];\n\nfunction createBoard() {\n const gameBoard = document.getElementById('game-board');\n gameBoard.innerHTML = '';\n board = [];\n\n for (let row = 0; row < boardSize; row++) {\n board[row] = [];\n for (let col = 0; col < boardSize; col++) {\n const cell = document.createElement('div');\n cell.classList.add('cell');\n cell.dataset.row = row;\n cell.dataset.col = col;\n cell.style.backgroundColor = getRandomColor();\n cell.addEventListener('click', handleCellClick);\n gameBoard.appendChild(cell);\n board[row][col] = cell;\n }\n }\n}\n\nfunction getRandomColor() {\n return colors[Math.floor(Math.random() * colors.length)];\n}\n\nfunction handleCellClick(event) {\n const clickedCell = event.target;\n const row = parseInt(clickedCell.dataset.row);\n const col = parseInt(clickedCell.dataset.col);\n\n const adjacentCells = [\n { row: row - 1, col },\n { row: row + 1, col },\n { row, col: col - 1 },\n { row, col: col + 1 }\n ];\n\n adjacentCells.forEach(adjacent => {\n const adjRow = adjacent.row;\n const adjCol = adjacent.col;\n if (adjRow >= 0 && adjRow < boardSize && adjCol >= 0 && adjCol < boardSize) {\n if (board[adjRow][adjCol].style.backgroundColor === clickedCell.style.backgroundColor) {\n score += 10;\n document.getElementById('score').textContent = score;\n board[adjRow][adjCol].style.backgroundColor = getRandomColor();\n clickedCell.style.backgroundColor = getRandomColor();\n }\n }\n });\n}\n\nwindow.onload = createBoard;\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 246, + "completion_tokens": 1018, + "total_tokens": 1264, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 246 + }, + "system_fingerprint": "fp_f1afce2943" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..2b1c429 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# candyswap.scroll.pub +Website generated by DeepSeek from prompt: Create a simple candy crush clone website that can be played online \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..96d5f0e --- /dev/null +++ b/script.js @@ -0,0 +1,56 @@ +const colors = ['#ff6f61', '#ffcc5c', '#88d8b0', '#96ceb4', '#ffeead']; +const boardSize = 8; +let score = 0; +let board = []; + +function createBoard() { + const gameBoard = document.getElementById('game-board'); + gameBoard.innerHTML = ''; + board = []; + + for (let row = 0; row < boardSize; row++) { + board[row] = []; + for (let col = 0; col < boardSize; col++) { + const cell = document.createElement('div'); + cell.classList.add('cell'); + cell.dataset.row = row; + cell.dataset.col = col; + cell.style.backgroundColor = getRandomColor(); + cell.addEventListener('click', handleCellClick); + gameBoard.appendChild(cell); + board[row][col] = cell; + } + } +} + +function getRandomColor() { + return colors[Math.floor(Math.random() * colors.length)]; +} + +function handleCellClick(event) { + const clickedCell = event.target; + const row = parseInt(clickedCell.dataset.row); + const col = parseInt(clickedCell.dataset.col); + + const adjacentCells = [ + { row: row - 1, col }, + { row: row + 1, col }, + { row, col: col - 1 }, + { row, col: col + 1 } + ]; + + adjacentCells.forEach(adjacent => { + const adjRow = adjacent.row; + const adjCol = adjacent.col; + if (adjRow >= 0 && adjRow < boardSize && adjCol >= 0 && adjCol < boardSize) { + if (board[adjRow][adjCol].style.backgroundColor === clickedCell.style.backgroundColor) { + score += 10; + document.getElementById('score').textContent = score; + board[adjRow][adjCol].style.backgroundColor = getRandomColor(); + clickedCell.style.backgroundColor = getRandomColor(); + } + } + }); +} + +window.onload = createBoard; \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..aff3bbd --- /dev/null +++ b/style.css @@ -0,0 +1,80 @@ +:root { + --primary-color: #ff6f61; + --secondary-color: #ffcc5c; + --background-color: #f4f4f4; + --text-color: #333; + --cell-size: 60px; +} + +* { + margin: 0; + padding: 0; + box-sizing: border-box; +} + +body { + font-family: 'Arial', sans-serif; + background-color: var(--background-color); + color: var(--text-color); + min-height: 100vh; + display: flex; + flex-direction: column; + align-items: center; + padding: 20px; +} + +header { + text-align: center; + margin-bottom: 20px; +} + +h1 { + color: var(--primary-color); + font-size: 2.5rem; + margin-bottom: 10px; +} + +.score { + font-size: 1.2rem; + font-weight: bold; +} + +#game-board { + display: grid; + grid-template-columns: repeat(8, var(--cell-size)); + grid-template-rows: repeat(8, var(--cell-size)); + gap: 5px; + background-color: white; + padding: 10px; + border-radius: 10px; + box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1); +} + +.cell { + width: var(--cell-size); + height: var(--cell-size); + border-radius: 10px; + cursor: pointer; + transition: transform 0.2s ease; +} + +.cell:hover { + transform: scale(1.1); +} + +footer { + margin-top: 20px; + text-align: center; + font-size: 0.9rem; + color: #666; +} + +@media (max-width: 600px) { + :root { + --cell-size: 40px; + } + + h1 { + font-size: 2rem; + } +} \ No newline at end of file