commit a97f38ae6e5a6b48ff8fc2dcfdd5206da099e413
Author: root <root@hub.scroll.pub> Date: 2024-12-29 15:26:41 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..1b189df --- /dev/null +++ b/body.html @@ -0,0 +1,17 @@ +<header> + <h1>Word Chain Game</h1> + <p>Challenge the computer in a battle of words!</p> +</header> +<main> + <section id="game"> + <div id="game-board"> + <label for="player-input">Your word:</label> + <input type="text" id="player-input" placeholder="Enter a word"> + <button id="submit-btn">Submit</button> + </div> + <div id="game-log"></div> + </section> +</main> +<footer> + <p>Enjoy the game!</p> +</footer> \ No newline at end of file diff --git a/index.scroll b/index.scroll new file mode 100644 index 0000000..19b3993 --- /dev/null +++ b/index.scroll @@ -0,0 +1,8 @@ +buildHtml +baseUrl https://wordchain.scroll.pub +metaTags +editButton /edit.html +title Word Chain Game +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..7d4877e --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "edf22abf-b80c-4599-9fbf-4f7ee2172078", + "object": "chat.completion", + "created": 1735485976, + "model": "deepseek-chat", + "choices": [ + { + "index": 0, + "message": { + "role": "assistant", + "content": "---domain---\nwordchain.scroll.pub\n---index.scroll---\nbuildHtml\nbaseUrl https://wordchain.scroll.pub\nmetaTags\neditButton /edit.html\ntitle Word Chain Game\nstyle.css\nbody.html\nscript.js\n---body.html---\n<header>\n <h1>Word Chain Game</h1>\n <p>Challenge the computer in a battle of words!</p>\n</header>\n<main>\n <section id=\"game\">\n <div id=\"game-board\">\n <label for=\"player-input\">Your word:</label>\n <input type=\"text\" id=\"player-input\" placeholder=\"Enter a word\">\n <button id=\"submit-btn\">Submit</button>\n </div>\n <div id=\"game-log\"></div>\n </section>\n</main>\n<footer>\n <p>Enjoy the game!</p>\n</footer>\n---style.css---\n:root {\n --primary-color: #4CAF50;\n --secondary-color: #45a049;\n --background-color: #f4f4f4;\n --text-color: #333;\n --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n}\n\nbody {\n font-family: var(--font-family);\n margin: 0;\n padding: 0;\n background-color: var(--background-color);\n color: var(--text-color);\n line-height: 1.6;\n}\n\nheader {\n background-color: var(--primary-color);\n color: white;\n padding: 20px 0;\n text-align: center;\n}\n\nmain {\n padding: 20px;\n max-width: 800px;\n margin: 0 auto;\n}\n\n#game-board {\n background: white;\n padding: 20px;\n border-radius: 8px;\n box-shadow: 0 2px 4px rgba(0,0,0,0.1);\n}\n\nlabel {\n display: block;\n margin-bottom: 10px;\n}\n\ninput[type=\"text\"] {\n width: calc(100% - 22px);\n padding: 10px;\n margin-bottom: 10px;\n border: 1px solid #ddd;\n border-radius: 4px;\n}\n\nbutton {\n background-color: var(--primary-color);\n color: white;\n border: none;\n padding: 10px 20px;\n border-radius: 4px;\n cursor: pointer;\n}\n\nbutton:hover {\n background-color: var(--secondary-color);\n}\n\n#game-log {\n margin-top: 20px;\n padding: 10px;\n background-color: #e9e9e9;\n border-radius: 4px;\n}\n\nfooter {\n text-align: center;\n padding: 20px;\n background-color: var(--primary-color);\n color: white;\n margin-top: 20px;\n}\n\n@media (max-width: 600px) {\n header h1 {\n font-size: 24px;\n }\n #game-board {\n padding: 15px;\n }\n}\n---script.js---\nconst words = [\"above\", \"active\", \"afraid\", \"after\", \"ago\", \"Alaska\", \"all\", \"also\", \"always\", \"amazing\", \"American\", \"and\", \"angry\", \"animal\", \"ant\", \"any\", \"anything\", \"apple\", \"April\", \"aren't\", \"are not\", \"arm\", \"art room\", \"ask\", \"at\", \"ate\", \"attention\", \"August\", \"aunt\", \"autumn\", \"baby\", \"bad\", \"badminton\", \"bag\", \"ball\", \"bamboo\", \"banana\", \"basket\", \"basketball\", \"bathroom\", \"be careful\", \"beach\", \"bear\", \"beautiful\", \"because\", \"become\", \"bed\", \"bedroom\", \"beef\", \"before\", \"behind\", \"beside\", \"best\", \"better\", \"between\", \"big\", \"bigger\", \"bike\", \"bird\", \"black\", \"blackboard\", \"blue\", \"boat\", \"boating\", \"body\", \"book\", \"bookstore\", \"both\", \"bottle\", \"bought\", \"bowl\", \"box\", \"boy\", \"bread\", \"breakfast\", \"breath\", \"bridge\", \"broken\", \"brother\", \"brown\", \"building\", \"bunny\", \"bus\", \"businessman\", \"busy\", \"but\", \"buy\", \"by\", \"cake\", \"camp\", \"Canada\", \"Canadian\", \"Canberra\", \"candy\", \"cap\", \"car\", \"carrot\", \"cartoon\", \"cat\", \"cave\", \"chair\", \"chase\", \"cheap\", \"cheetah\", \"chicken\", \"children\", \"China\", \"Chinese book\", \"chocolate\", \"chopsticks\", \"Christmas\", \"cinema\", \"class\", \"classroom\", \"clean\", \"clean my room\", \"cleaned\", \"clever\", \"climbing\", \"clock\", \"clothes\", \"cloudy\", \"club\", \"coach\", \"coat\", \"cold\", \"come on\", \"comic\", \"comic book\", \"computer\", \"computer room\", \"contest\", \"cook\", \"co\"];\n\nlet lastLetter = '';\n\ndocument.getElementById('submit-btn').addEventListener('click', function() {\n const playerInput = document.getElementById('player-input').value.toLowerCase();\n if (words.includes(playerInput)) {\n if (lastLetter === '' || playerInput.charAt(0) === lastLetter) {\n lastLetter = playerInput.charAt(playerInput.length - 1);\n document.getElementById('game-log').innerHTML += `<p>Player: ${playerInput}</p>`;\n computerTurn();\n } else {\n alert(`Your word must start with the letter \"${lastLetter}\"`);\n }\n } else {\n alert('Word not in list!');\n }\n document.getElementById('player-input').value = '';\n});\n\nfunction computerTurn() {\n const possibleWords = words.filter(word => word.charAt(0) === lastLetter);\n if (possibleWords.length > 0) {\n const computerWord = possibleWords[Math.floor(Math.random() * possibleWords.length)];\n lastLetter = computerWord.charAt(computerWord.length - 1);\n document.getElementById('game-log').innerHTML += `<p>Computer: ${computerWord}</p>`;\n } else {\n document.getElementById('game-log').innerHTML += `<p>Computer cannot find a word. You win!</p>`;\n }\n}\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 454, + "completion_tokens": 1414, + "total_tokens": 1868, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 454 + }, + "system_fingerprint": "fp_f1afce2943" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..e37494d --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# wordchain3.scroll.pub +Website generated by DeepSeek from prompt: 制作一个简单的“Word Chain”游戏,HTML格式。玩家将与电脑对战。游戏的基本逻辑将如下: 玩家输入一个单词。 电脑从列表中选择一个以该单词最后一个字母开头的单词。 游戏交替进行,直到电脑或玩家无法继续或输入了不在列表中的单词。 单词列表是: above active afraid after ago Alaska all also always amazing American and angry animal ant any anything apple April aren't = are not arm art room ask at ate attention August aunt autumn baby bad badminton bag ball bamboo banana basket basketball bathroom be careful beach bear beautiful because become bed bedroom beef before behind beside best better between big bigger bike bird black blackboard blue boat boating body book bookstore both bottle bought bowl box boy bread breakfast breath bridge broken brother brown building bunny bus businessman busy but buy by cake camp Canada Canadian Canberra candy cap car carrot cartoon cat cave chair chase cheap cheetah chicken children China Chinese book chocolate chopsticks Christmas cinema class classroom clean clean my room cleaned clever climbing clock clothes cloudy club coach coat cold come on comic comic book computer computer room contest cook co \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..bcdc3a6 --- /dev/null +++ b/script.js @@ -0,0 +1,30 @@ +const words = ["above", "active", "afraid", "after", "ago", "Alaska", "all", "also", "always", "amazing", "American", "and", "angry", "animal", "ant", "any", "anything", "apple", "April", "aren't", "are not", "arm", "art room", "ask", "at", "ate", "attention", "August", "aunt", "autumn", "baby", "bad", "badminton", "bag", "ball", "bamboo", "banana", "basket", "basketball", "bathroom", "be careful", "beach", "bear", "beautiful", "because", "become", "bed", "bedroom", "beef", "before", "behind", "beside", "best", "better", "between", "big", "bigger", "bike", "bird", "black", "blackboard", "blue", "boat", "boating", "body", "book", "bookstore", "both", "bottle", "bought", "bowl", "box", "boy", "bread", "breakfast", "breath", "bridge", "broken", "brother", "brown", "building", "bunny", "bus", "businessman", "busy", "but", "buy", "by", "cake", "camp", "Canada", "Canadian", "Canberra", "candy", "cap", "car", "carrot", "cartoon", "cat", "cave", "chair", "chase", "cheap", "cheetah", "chicken", "children", "China", "Chinese book", "chocolate", "chopsticks", "Christmas", "cinema", "class", "classroom", "clean", "clean my room", "cleaned", "clever", "climbing", "clock", "clothes", "cloudy", "club", "coach", "coat", "cold", "come on", "comic", "comic book", "computer", "computer room", "contest", "cook", "co"]; + +let lastLetter = ''; + +document.getElementById('submit-btn').addEventListener('click', function() { + const playerInput = document.getElementById('player-input').value.toLowerCase(); + if (words.includes(playerInput)) { + if (lastLetter === '' || playerInput.charAt(0) === lastLetter) { + lastLetter = playerInput.charAt(playerInput.length - 1); + document.getElementById('game-log').innerHTML += `<p>Player: ${playerInput}</p>`; + computerTurn(); + } else { + alert(`Your word must start with the letter "${lastLetter}"`); + } + } else { + alert('Word not in list!'); + } + document.getElementById('player-input').value = ''; +}); + +function computerTurn() { + const possibleWords = words.filter(word => word.charAt(0) === lastLetter); + if (possibleWords.length > 0) { + const computerWord = possibleWords[Math.floor(Math.random() * possibleWords.length)]; + lastLetter = computerWord.charAt(computerWord.length - 1); + document.getElementById('game-log').innerHTML += `<p>Computer: ${computerWord}</p>`; + } else { + document.getElementById('game-log').innerHTML += `<p>Computer cannot find a word. You win!</p>`; + } +} \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..892f125 --- /dev/null +++ b/style.css @@ -0,0 +1,86 @@ +:root { + --primary-color: #4CAF50; + --secondary-color: #45a049; + --background-color: #f4f4f4; + --text-color: #333; + --font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; +} + +body { + font-family: var(--font-family); + margin: 0; + padding: 0; + background-color: var(--background-color); + color: var(--text-color); + line-height: 1.6; +} + +header { + background-color: var(--primary-color); + color: white; + padding: 20px 0; + text-align: center; +} + +main { + padding: 20px; + max-width: 800px; + margin: 0 auto; +} + +#game-board { + background: white; + padding: 20px; + border-radius: 8px; + box-shadow: 0 2px 4px rgba(0,0,0,0.1); +} + +label { + display: block; + margin-bottom: 10px; +} + +input[type="text"] { + width: calc(100% - 22px); + padding: 10px; + margin-bottom: 10px; + border: 1px solid #ddd; + border-radius: 4px; +} + +button { + background-color: var(--primary-color); + color: white; + border: none; + padding: 10px 20px; + border-radius: 4px; + cursor: pointer; +} + +button:hover { + background-color: var(--secondary-color); +} + +#game-log { + margin-top: 20px; + padding: 10px; + background-color: #e9e9e9; + border-radius: 4px; +} + +footer { + text-align: center; + padding: 20px; + background-color: var(--primary-color); + color: white; + margin-top: 20px; +} + +@media (max-width: 600px) { + header h1 { + font-size: 24px; + } + #game-board { + padding: 15px; + } +} \ No newline at end of file