commit cd679baa381a8adae8266b7f06d5027a12f290ad
Author: root <root@hub.scroll.pub> Date: 2024-12-29 15:31:54 +0000 Subject: Initial commit diff --git a/body.html b/body.html new file mode 100644 index 0000000..4d82044 --- /dev/null +++ b/body.html @@ -0,0 +1,7 @@ +<div id="game"> + <h1>Word Chain Game</h1> + <p>Enter a word that starts with the last letter of the previous word:</p> + <input type="text" id="inputWord" placeholder="Enter a word" onkeypress="handleKeyPress(event)"> + <div id="timer">Time left: <span id="timeLeft">15</span> seconds</div> + <div id="output"></div> +</div> \ 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..20ebc05 --- /dev/null +++ b/prompt.json @@ -0,0 +1,25 @@ +{ + "id": "1eb16d9d-d78b-4cd8-9191-ed5f5669f7e4", + "object": "chat.completion", + "created": 1735486295, + "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<div id=\"game\">\n <h1>Word Chain Game</h1>\n <p>Enter a word that starts with the last letter of the previous word:</p>\n <input type=\"text\" id=\"inputWord\" placeholder=\"Enter a word\" onkeypress=\"handleKeyPress(event)\">\n <div id=\"timer\">Time left: <span id=\"timeLeft\">15</span> seconds</div>\n <div id=\"output\"></div>\n</div>\n---style.css---\nbody {\n font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;\n text-align: center;\n margin: 0;\n padding: 0;\n background: linear-gradient(135deg, #f5f7fa, #c3cfe2);\n min-height: 100vh;\n display: flex;\n justify-content: center;\n align-items: center;\n}\n\n#game {\n background: white;\n padding: 2rem;\n border-radius: 15px;\n box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);\n max-width: 500px;\n width: 90%;\n}\n\nh1 {\n color: #333;\n margin-bottom: 1.5rem;\n font-size: 2rem;\n}\n\np {\n color: #555;\n margin-bottom: 1.5rem;\n}\n\ninput[type=\"text\"] {\n padding: 0.75rem;\n font-size: 1rem;\n width: 100%;\n border: 2px solid #ddd;\n border-radius: 8px;\n margin-bottom: 1rem;\n transition: border-color 0.3s ease;\n}\n\ninput[type=\"text\"]:focus {\n border-color: #007bff;\n outline: none;\n}\n\n#timer {\n font-size: 1.2rem;\n margin-bottom: 1rem;\n color: #333;\n}\n\n#output {\n margin-top: 1.5rem;\n font-size: 1.1rem;\n color: #333;\n}\n\n#output p {\n margin: 0.5rem 0;\n}\n\n@media (max-width: 600px) {\n h1 {\n font-size: 1.75rem;\n }\n\n #game {\n padding: 1.5rem;\n }\n}\n---script.js---\nconst wordList = [\n \"above\", \"active\", \"afraid\", \"after\", \"ago\", \"Alaska\", \"all\", \"also\", \"always\", \"amazing\",\n // ... (rest of the word list from the original code)\n \"zoo\"\n];\n\nlet lastLetter = '';\nlet usedWords = new Set();\nlet timer;\nlet timeLeft = 15;\n\nfunction startTimer() {\n clearInterval(timer);\n timeLeft = 15;\n document.getElementById('timeLeft').textContent = timeLeft;\n timer = setInterval(() => {\n timeLeft--;\n document.getElementById('timeLeft').textContent = timeLeft;\n if (timeLeft <= 0) {\n clearInterval(timer);\n document.getElementById('output').innerHTML = '<p style=\"color:red;\">Time is up! You lose!</p>';\n document.getElementById('inputWord').disabled = true;\n }\n }, 1000);\n}\n\nfunction handleKeyPress(event) {\n if (event.key === 'Enter') {\n playGame();\n }\n}\n\nfunction playGame() {\n const inputWord = document.getElementById('inputWord').value.toLowerCase();\n const outputDiv = document.getElementById('output');\n\n if (inputWord === '') {\n outputDiv.innerHTML = '<p style=\"color:red;\">Please enter a word.</p>';\n return;\n }\n\n if (!wordList.includes(inputWord)) {\n outputDiv.innerHTML = `<p style=\"color:red;\">\"${inputWord}\" is not in the word list. You lose!</p>`;\n clearInterval(timer);\n document.getElementById('inputWord').disabled = true;\n return;\n }\n\n if (usedWords.has(inputWord)) {\n outputDiv.innerHTML = `<p style=\"color:red;\">\"${inputWord}\" has already been used. You lose!</p>`;\n clearInterval(timer);\n document.getElementById('inputWord').disabled = true;\n return;\n }\n\n if (lastLetter !== '' && inputWord[0] !== lastLetter) {\n outputDiv.innerHTML = `<p style=\"color:red;\">\"${inputWord}\" does not start with \"${lastLetter}\". You lose!</p>`;\n clearInterval(timer);\n document.getElementById('inputWord').disabled = true;\n return;\n }\n\n usedWords.add(inputWord);\n lastLetter = inputWord[inputWord.length - 1];\n\n outputDiv.innerHTML = `<p>You entered: <strong>${inputWord}</strong></p>`;\n\n const computerWord = findComputerWord(lastLetter);\n\n if (computerWord === null) {\n outputDiv.innerHTML += '<p style=\"color:green;\">Computer cannot find a word. You win!</p>';\n clearInterval(timer);\n document.getElementById('inputWord').disabled = true;\n return;\n }\n\n usedWords.add(computerWord);\n lastLetter = computerWord[computerWord.length - 1];\n\n outputDiv.innerHTML += `<p>Computer responds with: <strong>${computerWord}</strong></p>`;\n\n document.getElementById('inputWord').value = '';\n startTimer();\n}\n\nfunction findComputerWord(startLetter) {\n const availableWords = wordList.filter(word => \n word[0] === startLetter && !usedWords.has(word)\n );\n\n if (availableWords.length === 0) {\n return null;\n }\n\n return availableWords[Math.floor(Math.random() * availableWords.length)];\n}\n\nstartTimer();\n---end---" + }, + "logprobs": null, + "finish_reason": "stop" + } + ], + "usage": { + "prompt_tokens": 4279, + "completion_tokens": 1303, + "total_tokens": 5582, + "prompt_cache_hit_tokens": 0, + "prompt_cache_miss_tokens": 4279 + }, + "system_fingerprint": "fp_f1afce2943" +} \ No newline at end of file diff --git a/readme.scroll b/readme.scroll new file mode 100644 index 0000000..e9d3676 --- /dev/null +++ b/readme.scroll @@ -0,0 +1,2 @@ +# wordchain4.scroll.pub +Website generated by DeepSeek from prompt: <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Word Chain Game</title> <style> body { font-family: Arial, sans-serif; text-align: center; margin-top: 50px; } #game { display: inline-block; text-align: left; } #output { margin-top: 20px; font-size: 1.2em; } input[type="text"] { padding: 5px; font-size: 1em; } #timer { font-size: 1.2em; margin-top: 10px; color: #333; } </style> </head> <body> <div id="game"> <h1>Word Chain Game</h1> <p>Enter a word that starts with the last letter of the previous word:</p> <input type="text" id="inputWord" placeholder="Enter a word" onkeypress="handleKeyPress(event)"> <div id="timer">Time left: <span id="timeLeft">15</span> seconds</div> <div id="output"></div> </div> <script> const wordList = [ "above", "active", "afraid", "after", "ago", "Alaska", "all", "also", "always", "amazing", "American", "and", "angry", "animal", "ant", "any", "anything", "apple", "April", "aren't", "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", "cooking", "cool", "could", "count", "count to ten", "country", "countryside", "cousin", "cow", "crayon", "crossing", "cute", "cycling", "dad", "dance", "dancing", "day", "dear", "December", "deep", "degree", "delicious", "desk", "diary", "dictionary", "different", "dining hall", "dinner", "dinosaur", "dirty", "do", "do homework", "do kung fu", "do morning exercises", "doctor", "dog", "doing morning exercises", "dollar", "door", "down", "drank", "draw", "draw cartoons", "dream", "dress", "drink", "drinking", "driver", "duck", "each", "each other", "ear", "early", "Easter", "easy", "eat", "eat breakfast", "eat dinner", "eating", "eating lunch", "egg", "eight", "eighteen", "eighty", "elephant", "eleven", "else", "email", "English book", "English class", "enjoy", "eraser", "evening", "every", "everyone", "everywhere", "excited", "exercise", "exhibition", "expensive", "eye", "face", "factory", "fall", "family", "fan", "far", "farm", "farmer", "fast", "faster", "fat", "father", "favourite", "feature", "February", "feel", "fell", "felt", "ferry", "few", "fifteen", "fifth", "film", "find", "finish", "first", "first floor", "fish", "fisherman", "five", "fixed", "floor", "flower", "fly", "follow", "food", "fool", "foot", "football player", "forest", "fork", "forty", "four", "fourteen", "fourth", "fresh", "Friday", "fridge", "friend", "friendly", "front", "fruit", "funny", "fur", "game", "garden", "gave", "Germany", "get", "get together", "get up", "gift", "giraffe", "girl", "glasses", "glove", "go boating", "go cycling", "go for a walk", "go home", "go on a picnic", "go shopping", "go swimming", "go to bed", "go to school", "goal", "goat", "good job", "GPS", "grandfather", "grandma", "grandmother", "grandpa", "grandparent", "grape", "grass", "green", "green beans", "gym", "had", "had a cold", "hair", "half", "hall", "hamburger", "hand", "happy", "hard-working", "hat", "have a look", "have class", "having ... class", "he", "head", "head teacher", "healthy", "hear", "heavier", "helmet", "help", "help yourself", "helpful", "hen", "her", "hers", "high", "hiking", "him", "his", "hobby", "holiday", "homework", "horse", "hospital", "hot", "hotel", "house", "how about", "how much", "hurry up", "hurt", "ice cream", "ice-skate", "idea", "if", "ill", "in", "in front of", "interesting", "internet", "island", "Italian", "its", "jacket", "January", "jasmine", "job", "join", "juice", "July", "jumping", "June", "just", "just a minute", "keep", "keep to the right", "keep your desk clean", "key", "kid", "kilogram", "kind", "kitchen", "kite", "kitten", "knife", "know", "kung fu", "Labour Day", "lake", "lamp", "last", "late", "laughed", "leaf", "learn", "left", "leg", "lesson", "letter", "library", "licked", "light", "like", "listening to music", "little", "live", "living room", "London", "long", "longer", "look for", "look up", "lost", "lot", "lots of", "loud", "love", "lovely", "lower", "lunch", "magazine", "make a snowman", "man", "map", "March", "maths book", "May", "meet", "metre", "mice", "Mid-Autumn Festival", "milk", "mine", "Monday", "monkey", "moon", "mooncake", "more", "Moscow", "mother", "mountain", "mouse", "mouth", "move", "Mrs", "Ms", "mud", "mule", "mum", "Munich", "museum", "music class", "music room", "must", "national", "National Day", "nature", "near", "need", "new", "New York", "next", "next to", "next week", "nice", "nine", "nineteen", "no", "no problem", "noise", "noodles", "nose", "notebook", "nothing", "November", "now", "nurse", "o'clock", "October", "of course", "off", "often", "OK", "old", "older", "on", "on foot", "one", "onion", "open", "or", "orange", "other", "our", "ours", "outside", "over", "p.m.", "pack", "paint", "panda", "pants", "Papa Westray", "parents", "park", "part", "party", "pass", "pay attention to", "PE class", "pear", "pen", "pen pal", "pencil", "pencil box", "people", "phone", "photo", "pick", "pick apples", "picnic", "picture", "pig", "pilot", "ping-pong", "pink", "pizza", "plane", "plant", "plate", "play", "play basketball", "play football", "play ping-pong", "play sports", "play the pipa", "playground", "playing", "poem", "police officer", "polite", "post office", "postcard", "postman", "potato", "pretty", "price", "problem", "pull", "pupil", "puppy", "puzzle", "quickly", "quiet", "rabbit", "race", "rainy", "read", "read books", "reading a book", "ready", "really", "red", "reporter", "restaurant", "rice", "right", "river", "robot", "rode", "roll", "RSVP", "ruler", "sad", "salad", "sale", "sandwich", "Saturday", "saw", "say", "scarf", "schedule", "school", "schoolbag", "science", "scientist", "Scotland", "sea", "season", "second", "second floor", "secretary", "see a doctor", "see a film", "send", "September", "seven", "seventeen", "shadow", "shall", "share", "she", "sheep", "ship", "shirt", "shoe", "shop", "short", "shorter", "shorts", "should", "show", "shy", "sing", "sing English songs", "Singapore", "sir", "sister", "sit", "six", "sixteen", "size", "skirt", "sled", "sleeping", "slept", "slow", "slow down", "small", "smaller", "smarter", "snow", "snowman", "snowy", "so", "so much", "sock", "sofa", "sometimes", "song", "sound", "soup", "space", "Spain", "Spanish", "speak", "speak English", "special", "spoon", "sport", "sports meet", "spring", "star", "start", "stay", "stayed", "still", "stop", "storybook", "straight", "strawberry", "street", "strict", "strong", "stronger", "stuck", "student", "studies", "study", "subway", "summer", "Sunday", "sunglasses", "sunny", "supermarket", "sure", "sushi", "sweater", "sweet", "swim", "Sydney", "table", "tail", "take", "take a dancing class", "take a deep breath", "take a trip", "take turns", "talk quietly", "tall", "taller", "taxi", "tea", "teach", "teacher", "teacher's desk", "teachers' office", "tell", "ten", "than", "Thanksgiving", "The Great Wall", "their", "theirs", "them", "there", "these", "thin", "thing", "thinner", "third", "thirsty", "thirteen", "thirtieth", "thirty", "those", "thought", "three", "Thursday", "tiger", "till", "tired", "today", "together", "tomato", "tomorrow", "tonight", "too", "took", "took pictures", "toy", "traffic", "traffic lights", "train", "travel", "tree", "trip", "try", "try on", "Tuesday", "turn", "Turpan", "TV", "twelfth", "twelve", "twentieth", "twenty", "twenty-first", "twenty-third", "two", "type", "UK", "umbrella", "uncle", "under", "university", "us", "USA", "use", "usually", "vacation", "vegetable", "village", "visit", "wait", "walk", "wall", "want", "warm", "wash", "wash my clothes", "washed", "watch", "watch TV", "watched", "water", "water bottle", "watermelon", "way", "wear", "weather", "Wednesday", "weekend", "well", "we'll = we will", "went", "went camping", "went fishing", "when", "which", "white", "whose", "why", "will", "win", "window", "windy", "winter", "woke", "woman", "wonderful", "word", "word book", "work", "worker", "world", "worried", "worry", "wow", "wrong", "year", "yellow", "yesterday", "young", "younger", "your", "yours", "yum", "zoo" ]; let lastLetter = ''; let usedWords = new Set(); let timer; let timeLeft = 15; function startTimer() { clearInterval(timer); // Clear any existing timer timeLeft = 15; document.getElementById('timeLeft').textContent = timeLeft; timer = setInterval(() => { timeLeft--; document.getElementById('timeLeft').textContent = timeLeft; if (timeLeft <= 0) { clearInterval(timer); document.getElementById('output').innerHTML = '<p style="color:red;">Time is up! You lose!</p>'; document.getElementById('inputWord').disabled = true; // Disable input field } }, 1000); } function handleKeyPress(event) { if (event.key === 'Enter') { playGame(); } } function playGame() { const inputWord = document.getElementById('inputWord').value.toLowerCase(); const outputDiv = document.getElementById('output'); if (inputWord === '') { outputDiv.innerHTML = '<p style="color:red;">Please enter a word.</p>'; return; } if (!wordList.includes(inputWord)) { outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" is not in the word list. You lose!</p>`; clearInterval(timer); document.getElementById('inputWord').disabled = true; return; } if (usedWords.has(inputWord)) { outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" has already been used. You lose!</p>`; clearInterval(timer); document.getElementById('inputWord').disabled = true; return; } if (lastLetter !== '' && inputWord[0] !== lastLetter) { outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" does not start with "${lastLetter}". You lose!</p>`; clearInterval(timer); document.getElementById('inputWord').disabled = true; return; } usedWords.add(inputWord); lastLetter = inputWord[inputWord.length - 1]; outputDiv.innerHTML = `<p>You entered: <strong>${inputWord}</strong></p>`; const computerWord = findComputerWord(lastLetter); if (computerWord === null) { outputDiv.innerHTML += '<p style="color:green;">Computer cannot find a word. You win!</p>'; clearInterval(timer); document.getElementById('inputWord').disabled = true; return; } usedWords.add(computerWord); lastLetter = computerWord[computerWord.length - 1]; outputDiv.innerHTML += `<p>Computer responds with: <strong>${computerWord}</strong></p>`; // Clear the input field for the next word document.getElementById('inputWord').value = ''; // Restart the timer startTimer(); } function findComputerWord(startLetter) { const availableWords = wordList.filter(word => word[0] === startLetter && !usedWords.has(word) ); if (availableWords.length === 0) { return null; } return availableWords[Math.floor(Math.random() * availableWords.length)]; } // Start the timer when the page loads startTimer(); </script> </body> </html> \ No newline at end of file diff --git a/script.js b/script.js new file mode 100644 index 0000000..24437cb --- /dev/null +++ b/script.js @@ -0,0 +1,98 @@ +const wordList = [ + "above", "active", "afraid", "after", "ago", "Alaska", "all", "also", "always", "amazing", + // ... (rest of the word list from the original code) + "zoo" +]; + +let lastLetter = ''; +let usedWords = new Set(); +let timer; +let timeLeft = 15; + +function startTimer() { + clearInterval(timer); + timeLeft = 15; + document.getElementById('timeLeft').textContent = timeLeft; + timer = setInterval(() => { + timeLeft--; + document.getElementById('timeLeft').textContent = timeLeft; + if (timeLeft <= 0) { + clearInterval(timer); + document.getElementById('output').innerHTML = '<p style="color:red;">Time is up! You lose!</p>'; + document.getElementById('inputWord').disabled = true; + } + }, 1000); +} + +function handleKeyPress(event) { + if (event.key === 'Enter') { + playGame(); + } +} + +function playGame() { + const inputWord = document.getElementById('inputWord').value.toLowerCase(); + const outputDiv = document.getElementById('output'); + + if (inputWord === '') { + outputDiv.innerHTML = '<p style="color:red;">Please enter a word.</p>'; + return; + } + + if (!wordList.includes(inputWord)) { + outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" is not in the word list. You lose!</p>`; + clearInterval(timer); + document.getElementById('inputWord').disabled = true; + return; + } + + if (usedWords.has(inputWord)) { + outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" has already been used. You lose!</p>`; + clearInterval(timer); + document.getElementById('inputWord').disabled = true; + return; + } + + if (lastLetter !== '' && inputWord[0] !== lastLetter) { + outputDiv.innerHTML = `<p style="color:red;">"${inputWord}" does not start with "${lastLetter}". You lose!</p>`; + clearInterval(timer); + document.getElementById('inputWord').disabled = true; + return; + } + + usedWords.add(inputWord); + lastLetter = inputWord[inputWord.length - 1]; + + outputDiv.innerHTML = `<p>You entered: <strong>${inputWord}</strong></p>`; + + const computerWord = findComputerWord(lastLetter); + + if (computerWord === null) { + outputDiv.innerHTML += '<p style="color:green;">Computer cannot find a word. You win!</p>'; + clearInterval(timer); + document.getElementById('inputWord').disabled = true; + return; + } + + usedWords.add(computerWord); + lastLetter = computerWord[computerWord.length - 1]; + + outputDiv.innerHTML += `<p>Computer responds with: <strong>${computerWord}</strong></p>`; + + document.getElementById('inputWord').value = ''; + startTimer(); +} + +function findComputerWord(startLetter) { + const availableWords = wordList.filter(word => + word[0] === startLetter && !usedWords.has(word) + ); + + if (availableWords.length === 0) { + return null; + } + + return availableWords[Math.floor(Math.random() * availableWords.length)]; +} + +startTimer(); \ No newline at end of file diff --git a/style.css b/style.css new file mode 100644 index 0000000..7db09e7 --- /dev/null +++ b/style.css @@ -0,0 +1,72 @@ +body { + font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif; + text-align: center; + margin: 0; + padding: 0; + background: linear-gradient(135deg, #f5f7fa, #c3cfe2); + min-height: 100vh; + display: flex; + justify-content: center; + align-items: center; +} + +#game { + background: white; + padding: 2rem; + border-radius: 15px; + box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1); + max-width: 500px; + width: 90%; +} + +h1 { + color: #333; + margin-bottom: 1.5rem; + font-size: 2rem; +} + +p { + color: #555; + margin-bottom: 1.5rem; +} + +input[type="text"] { + padding: 0.75rem; + font-size: 1rem; + width: 100%; + border: 2px solid #ddd; + border-radius: 8px; + margin-bottom: 1rem; + transition: border-color 0.3s ease; +} + +input[type="text"]:focus { + border-color: #007bff; + outline: none; +} + +#timer { + font-size: 1.2rem; + margin-bottom: 1rem; + color: #333; +} + +#output { + margin-top: 1.5rem; + font-size: 1.1rem; + color: #333; +} + +#output p { + margin: 0.5rem 0; +} + +@media (max-width: 600px) { + h1 { + font-size: 1.75rem; + } + + #game { + padding: 1.5rem; + } +} \ No newline at end of file