commit 9abcef14e05ce8116aa2d079aa90fe3b350fe662
Author: root <root@hub.scroll.pub>
Date: 2024-12-29 17:49:43 +0000
Subject: Initial commit
diff --git a/body.html b/body.html
new file mode 100644
index 0000000..e01636e
--- /dev/null
+++ b/body.html
@@ -0,0 +1,14 @@
+<header>
+ <h1>Cherry Mine</h1>
+ <p>A sweet twist on the classic Minesweeper game!</p>
+</header>
+<main>
+ <div class="game-controls">
+ <button id="reset">New Game</button>
+ <div class="score">Cherries Left: <span id="cherriesLeft">0</span></div>
+ </div>
+ <div id="gameBoard" class="game-board"></div>
+</main>
+<footer>
+ <p>Click to reveal cells, right-click to flag cherries. Find all the cherries to win!</p>
+</footer>
\ No newline at end of file
diff --git a/index.scroll b/index.scroll
new file mode 100644
index 0000000..9fa5e35
--- /dev/null
+++ b/index.scroll
@@ -0,0 +1,8 @@
+buildHtml
+baseUrl https://cherrymine.scroll.pub
+metaTags
+editButton /edit.html
+title Cherry Mine - A Sweet Twist on Minesweeper
+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..50e12a0
--- /dev/null
+++ b/prompt.json
@@ -0,0 +1,25 @@
+{
+ "id": "09b7c48b-9148-40e5-96e0-ead5292f5cfc",
+ "object": "chat.completion",
+ "created": 1735494556,
+ "model": "deepseek-chat",
+ "choices": [
+ {
+ "index": 0,
+ "message": {
+ "role": "assistant",
+ "content": "---domain---\ncherrymine.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://cherrymine.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Cherry Mine - A Sweet Twist on Minesweeper\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Cherry Mine</h1>\n <p>A sweet twist on the classic Minesweeper game!</p>\n</header>\n<main>\n <div class=\"game-controls\">\n <button id=\"reset\">New Game</button>\n <div class=\"score\">Cherries Left: <span id=\"cherriesLeft\">0</span></div>\n </div>\n <div id=\"gameBoard\" class=\"game-board\"></div>\n</main>\n<footer>\n <p>Click to reveal cells, right-click to flag cherries. Find all the cherries to win!</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #e63946;\n --secondary-color: #f1faee;\n --background-color: #a8dadc;\n --cell-size: 40px;\n}\n\nbody {\n font-family: 'Segoe UI', sans-serif;\n background-color: var(--background-color);\n color: var(--primary-color);\n margin: 0;\n padding: 20px;\n display: flex;\n flex-direction: column;\n align-items: center;\n min-height: 100vh;\n}\n\nheader {\n text-align: center;\n margin-bottom: 2rem;\n}\n\nh1 {\n font-size: 2.5rem;\n margin: 0;\n}\n\n.game-controls {\n display: flex;\n justify-content: space-between;\n align-items: center;\n width: 100%;\n max-width: 400px;\n margin-bottom: 1rem;\n}\n\n#reset {\n background-color: var(--primary-color);\n color: var(--secondary-color);\n border: none;\n padding: 0.5rem 1rem;\n border-radius: 5px;\n cursor: pointer;\n font-size: 1rem;\n}\n\n.score {\n font-size: 1.2rem;\n}\n\n.game-board {\n display: grid;\n gap: 2px;\n background-color: var(--primary-color);\n padding: 2px;\n border-radius: 5px;\n}\n\n.cell {\n width: var(--cell-size);\n height: var(--cell-size);\n background-color: var(--secondary-color);\n display: flex;\n align-items: center;\n justify-content: center;\n cursor: pointer;\n user-select: none;\n border-radius: 3px;\n transition: background-color 0.2s;\n}\n\n.cell.revealed {\n background-color: #457b9d;\n color: white;\n}\n\n.cell.flagged {\n background-color: #f4a261;\n}\n\n.cell.cherry {\n background-color: var(--primary-color);\n color: white;\n}\n\nfooter {\n margin-top: 2rem;\n text-align: center;\n color: #1d3557;\n}\n\n@media (max-width: 600px) {\n :root {\n --cell-size: 30px;\n }\n\n h1 {\n font-size: 2rem;\n }\n}\n---script.js---\nconst boardSize = 8;\nconst cherryCount = 10;\nlet board = [];\nlet revealedCount = 0;\nlet flaggedCount = 0;\nlet gameOver = false;\n\nconst gameBoard = document.getElementById('gameBoard');\nconst cherriesLeft = document.getElementById('cherriesLeft');\nconst resetButton = document.getElementById('reset');\n\nfunction initGame() {\n gameBoard.innerHTML = '';\n gameBoard.style.gridTemplateColumns = `repeat(${boardSize}, 1fr)`;\n board = createBoard();\n placeCherries();\n calculateNumbers();\n renderBoard();\n gameOver = false;\n revealedCount = 0;\n flaggedCount = 0;\n cherriesLeft.textContent = cherryCount;\n}\n\nfunction createBoard() {\n return Array.from({ length: boardSize }, () => \n Array.from({ length: boardSize }, () => ({\n isCherry: false,\n isRevealed: false,\n isFlagged: false,\n number: 0\n }))\n );\n}\n\nfunction placeCherries() {\n let placed = 0;\n while (placed < cherryCount) {\n const row = Math.floor(Math.random() * boardSize);\n const col = Math.floor(Math.random() * boardSize);\n if (!board[row][col].isCherry) {\n board[row][col].isCherry = true;\n placed++;\n }\n }\n}\n\nfunction calculateNumbers() {\n for (let row = 0; row < boardSize; row++) {\n for (let col = 0; col < boardSize; col++) {\n if (!board[row][col].isCherry) {\n board[row][col].number = countAdjacentCherries(row, col);\n }\n }\n }\n}\n\nfunction countAdjacentCherries(row, col) {\n let count = 0;\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n if (i === 0 && j === 0) continue;\n const newRow = row + i;\n const newCol = col + j;\n if (newRow >= 0 && newRow < boardSize && newCol >= 0 && newCol < boardSize && board[newRow][newCol].isCherry) {\n count++;\n }\n }\n }\n return count;\n}\n\nfunction renderBoard() {\n board.forEach((row, rowIndex) => {\n row.forEach((cell, colIndex) => {\n const cellElement = document.createElement('div');\n cellElement.classList.add('cell');\n cellElement.dataset.row = rowIndex;\n cellElement.dataset.col = colIndex;\n\n if (cell.isRevealed) {\n cellElement.classList.add('revealed');\n if (cell.isCherry) {\n cellElement.classList.add('cherry');\n cellElement.textContent = '🍒';\n } else if (cell.number > 0) {\n cellElement.textContent = cell.number;\n }\n } else if (cell.isFlagged) {\n cellElement.classList.add('flagged');\n cellElement.textContent = '🚩';\n }\n\n cellElement.addEventListener('click', handleCellClick);\n cellElement.addEventListener('contextmenu', handleRightClick);\n\n gameBoard.appendChild(cellElement);\n });\n });\n}\n\nfunction handleCellClick(event) {\n if (gameOver) return;\n const row = parseInt(event.target.dataset.row);\n const col = parseInt(event.target.dataset.col);\n const cell = board[row][col];\n\n if (cell.isFlagged || cell.isRevealed) return;\n\n cell.isRevealed = true;\n revealedCount++;\n\n if (cell.isCherry) {\n gameOver = true;\n revealAllCherries();\n alert('Oops! You found a cherry. Game over!');\n return;\n }\n\n if (cell.number === 0) {\n revealAdjacentCells(row, col);\n }\n\n if (revealedCount === boardSize * boardSize - cherryCount) {\n gameOver = true;\n alert('Congratulations! You found all the cherries!');\n }\n\n renderBoard();\n}\n\nfunction handleRightClick(event) {\n event.preventDefault();\n if (gameOver) return;\n const row = parseInt(event.target.dataset.row);\n const col = parseInt(event.target.dataset.col);\n const cell = board[row][col];\n\n if (cell.isRevealed) return;\n\n cell.isFlagged = !cell.isFlagged;\n flaggedCount += cell.isFlagged ? 1 : -1;\n cherriesLeft.textContent = cherryCount - flaggedCount;\n renderBoard();\n}\n\nfunction revealAdjacentCells(row, col) {\n for (let i = -1; i <= 1; i++) {\n for (let j = -1; j <= 1; j++) {\n if (i === 0 && j === 0) continue;\n const newRow = row + i;\n const newCol = col + j;\n if (newRow >= 0 && newRow < boardSize && newCol >= 0 && newCol < boardSize) {\n const cell = board[newRow][newCol];\n if (!cell.isRevealed && !cell.isFlagged && !cell.isCherry) {\n cell.isRevealed = true;\n revealedCount++;\n if (cell.number === 0) {\n revealAdjacentCells(newRow, newCol);\n }\n }\n }\n }\n }\n}\n\nfunction revealAllCherries() {\n board.forEach(row => {\n row.forEach(cell => {\n if (cell.isCherry) {\n cell.isRevealed = true;\n }\n });\n });\n renderBoard();\n}\n\nresetButton.addEventListener('click', initGame);\n\n// Initialize the game\ninitGame();\n---end---"
+ },
+ "logprobs": null,
+ "finish_reason": "stop"
+ }
+ ],
+ "usage": {
+ "prompt_tokens": 249,
+ "completion_tokens": 1964,
+ "total_tokens": 2213,
+ "prompt_cache_hit_tokens": 0,
+ "prompt_cache_miss_tokens": 249
+ },
+ "system_fingerprint": "fp_f1afce2943"
+}
\ No newline at end of file
diff --git a/readme.scroll b/readme.scroll
new file mode 100644
index 0000000..e4ba8e8
--- /dev/null
+++ b/readme.scroll
@@ -0,0 +1,2 @@
+# cherrymine.scroll.pub
+Website generated by DeepSeek from prompt: A minesweeper game, but instead of bombs, use cherries. Javascript
\ No newline at end of file
diff --git a/script.js b/script.js
new file mode 100644
index 0000000..bd1caf1
--- /dev/null
+++ b/script.js
@@ -0,0 +1,181 @@
+const boardSize = 8;
+const cherryCount = 10;
+let board = [];
+let revealedCount = 0;
+let flaggedCount = 0;
+let gameOver = false;
+
+const gameBoard = document.getElementById('gameBoard');
+const cherriesLeft = document.getElementById('cherriesLeft');
+const resetButton = document.getElementById('reset');
+
+function initGame() {
+ gameBoard.innerHTML = '';
+ gameBoard.style.gridTemplateColumns = `repeat(${boardSize}, 1fr)`;
+ board = createBoard();
+ placeCherries();
+ calculateNumbers();
+ renderBoard();
+ gameOver = false;
+ revealedCount = 0;
+ flaggedCount = 0;
+ cherriesLeft.textContent = cherryCount;
+}
+
+function createBoard() {
+ return Array.from({ length: boardSize }, () =>
+ Array.from({ length: boardSize }, () => ({
+ isCherry: false,
+ isRevealed: false,
+ isFlagged: false,
+ number: 0
+ }))
+ );
+}
+
+function placeCherries() {
+ let placed = 0;
+ while (placed < cherryCount) {
+ const row = Math.floor(Math.random() * boardSize);
+ const col = Math.floor(Math.random() * boardSize);
+ if (!board[row][col].isCherry) {
+ board[row][col].isCherry = true;
+ placed++;
+ }
+ }
+}
+
+function calculateNumbers() {
+ for (let row = 0; row < boardSize; row++) {
+ for (let col = 0; col < boardSize; col++) {
+ if (!board[row][col].isCherry) {
+ board[row][col].number = countAdjacentCherries(row, col);
+ }
+ }
+ }
+}
+
+function countAdjacentCherries(row, col) {
+ let count = 0;
+ for (let i = -1; i <= 1; i++) {
+ for (let j = -1; j <= 1; j++) {
+ if (i === 0 && j === 0) continue;
+ const newRow = row + i;
+ const newCol = col + j;
+ if (newRow >= 0 && newRow < boardSize && newCol >= 0 && newCol < boardSize && board[newRow][newCol].isCherry) {
+ count++;
+ }
+ }
+ }
+ return count;
+}
+
+function renderBoard() {
+ board.forEach((row, rowIndex) => {
+ row.forEach((cell, colIndex) => {
+ const cellElement = document.createElement('div');
+ cellElement.classList.add('cell');
+ cellElement.dataset.row = rowIndex;
+ cellElement.dataset.col = colIndex;
+
+ if (cell.isRevealed) {
+ cellElement.classList.add('revealed');
+ if (cell.isCherry) {
+ cellElement.classList.add('cherry');
+ cellElement.textContent = '🍒';
+ } else if (cell.number > 0) {
+ cellElement.textContent = cell.number;
+ }
+ } else if (cell.isFlagged) {
+ cellElement.classList.add('flagged');
+ cellElement.textContent = '🚩';
+ }
+
+ cellElement.addEventListener('click', handleCellClick);
+ cellElement.addEventListener('contextmenu', handleRightClick);
+
+ gameBoard.appendChild(cellElement);
+ });
+ });
+}
+
+function handleCellClick(event) {
+ if (gameOver) return;
+ const row = parseInt(event.target.dataset.row);
+ const col = parseInt(event.target.dataset.col);
+ const cell = board[row][col];
+
+ if (cell.isFlagged || cell.isRevealed) return;
+
+ cell.isRevealed = true;
+ revealedCount++;
+
+ if (cell.isCherry) {
+ gameOver = true;
+ revealAllCherries();
+ alert('Oops! You found a cherry. Game over!');
+ return;
+ }
+
+ if (cell.number === 0) {
+ revealAdjacentCells(row, col);
+ }
+
+ if (revealedCount === boardSize * boardSize - cherryCount) {
+ gameOver = true;
+ alert('Congratulations! You found all the cherries!');
+ }
+
+ renderBoard();
+}
+
+function handleRightClick(event) {
+ event.preventDefault();
+ if (gameOver) return;
+ const row = parseInt(event.target.dataset.row);
+ const col = parseInt(event.target.dataset.col);
+ const cell = board[row][col];
+
+ if (cell.isRevealed) return;
+
+ cell.isFlagged = !cell.isFlagged;
+ flaggedCount += cell.isFlagged ? 1 : -1;
+ cherriesLeft.textContent = cherryCount - flaggedCount;
+ renderBoard();
+}
+
+function revealAdjacentCells(row, col) {
+ for (let i = -1; i <= 1; i++) {
+ for (let j = -1; j <= 1; j++) {
+ if (i === 0 && j === 0) continue;
+ const newRow = row + i;
+ const newCol = col + j;
+ if (newRow >= 0 && newRow < boardSize && newCol >= 0 && newCol < boardSize) {
+ const cell = board[newRow][newCol];
+ if (!cell.isRevealed && !cell.isFlagged && !cell.isCherry) {
+ cell.isRevealed = true;
+ revealedCount++;
+ if (cell.number === 0) {
+ revealAdjacentCells(newRow, newCol);
+ }
+ }
+ }
+ }
+ }
+}
+
+function revealAllCherries() {
+ board.forEach(row => {
+ row.forEach(cell => {
+ if (cell.isCherry) {
+ cell.isRevealed = true;
+ }
+ });
+ });
+ renderBoard();
+}
+
+resetButton.addEventListener('click', initGame);
+
+// Initialize the game
+initGame();
\ No newline at end of file
diff --git a/style.css b/style.css
new file mode 100644
index 0000000..9159601
--- /dev/null
+++ b/style.css
@@ -0,0 +1,102 @@
+:root {
+ --primary-color: #e63946;
+ --secondary-color: #f1faee;
+ --background-color: #a8dadc;
+ --cell-size: 40px;
+}
+
+body {
+ font-family: 'Segoe UI', sans-serif;
+ background-color: var(--background-color);
+ color: var(--primary-color);
+ margin: 0;
+ padding: 20px;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ min-height: 100vh;
+}
+
+header {
+ text-align: center;
+ margin-bottom: 2rem;
+}
+
+h1 {
+ font-size: 2.5rem;
+ margin: 0;
+}
+
+.game-controls {
+ display: flex;
+ justify-content: space-between;
+ align-items: center;
+ width: 100%;
+ max-width: 400px;
+ margin-bottom: 1rem;
+}
+
+#reset {
+ background-color: var(--primary-color);
+ color: var(--secondary-color);
+ border: none;
+ padding: 0.5rem 1rem;
+ border-radius: 5px;
+ cursor: pointer;
+ font-size: 1rem;
+}
+
+.score {
+ font-size: 1.2rem;
+}
+
+.game-board {
+ display: grid;
+ gap: 2px;
+ background-color: var(--primary-color);
+ padding: 2px;
+ border-radius: 5px;
+}
+
+.cell {
+ width: var(--cell-size);
+ height: var(--cell-size);
+ background-color: var(--secondary-color);
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ cursor: pointer;
+ user-select: none;
+ border-radius: 3px;
+ transition: background-color 0.2s;
+}
+
+.cell.revealed {
+ background-color: #457b9d;
+ color: white;
+}
+
+.cell.flagged {
+ background-color: #f4a261;
+}
+
+.cell.cherry {
+ background-color: var(--primary-color);
+ color: white;
+}
+
+footer {
+ margin-top: 2rem;
+ text-align: center;
+ color: #1d3557;
+}
+
+@media (max-width: 600px) {
+ :root {
+ --cell-size: 30px;
+ }
+
+ h1 {
+ font-size: 2rem;
+ }
+}
\ No newline at end of file