{"id":288,"date":"2026-08-07T12:12:18","date_gmt":"2026-08-07T12:12:18","guid":{"rendered":"https:\/\/ndovu.org.uk\/cs\/?p=288"},"modified":"2026-09-25T10:42:55","modified_gmt":"2026-09-25T10:42:55","slug":"term-1-13-training-the-chickbot","status":"publish","type":"post","link":"https:\/\/ndovu.org.uk\/cs\/term-1-13-training-the-chickbot\/","title":{"rendered":"Yr4 Term 1.13 Training the chickbot"},"content":{"rendered":"\n<div style=\"font-family: sans-serif; max-width: 800px; margin: 0 auto;\">\n    <h1 style=\"text-align: center;\">\ud83d\udc25 Session 3: Programming the Chickbot<\/h1>\n\n    <!-- Key Vocab Box -->\n    <div style=\"background-color: #fff2e8; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #ffd8bf;\">\n        <h3 style=\"margin-top: 0;\">\ud83d\udca1 Key Words Today<\/h3>\n        <ul style=\"margin-bottom: 0; line-height: 1.6;\">\n            <li><strong>Chatbot:<\/strong> A computer program designed to have a conversation with human users.<\/li>\n            <li><strong>Code:<\/strong> The instructions we write to tell a computer exactly what to do.<\/li>\n        <\/ul>\n    <\/div>\n\n    <!-- Starter Box -->\n    <div style=\"background-color: #f6ffed; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #b7eb8f;\">\n        <h2 style=\"margin-top: 0;\">1. Finger Warm-Up \u2328\ufe0f<\/h2>\n        <p>Spend 5-10 minutes practicing your touch typing. Remember to keep your fingers on the correct keys to build your speed!<\/p>\n        <a href=\"https:\/\/ndovu.org.uk\/type\" target=\"_blank\" style=\"display: inline-block; background-color: #52c41a; color: white; padding: 12px 24px; text-decoration: none; border-radius: 8px; font-weight: bold; margin-top: 10px;\">\u2328\ufe0f Open Typing Practice<\/a>\n    <\/div>\n\n    <!-- EMBEDDED MODULE 4: TRAIN CLUCKYBOT -->\n    <style>\n        .cluckybot-container { background-color: #e6fffb; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #87e8de; }\n        .cluckybot-container .lesson-box { background: #eef2f3; border-left: 5px solid #2980b9; padding: 15px; margin-bottom: 20px; border-radius: 5px; font-size: 15px; line-height: 1.6;}\n        .cluckybot-container .chat-window { background: #fff; border-radius: 10px; padding: 20px; height: 300px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; border: 1px solid #bdc3c7;}\n        .cluckybot-container .chat-msg { padding: 10px 15px; border-radius: 15px; max-width: 70%; font-size: 15px; font-family: sans-serif; line-height: 1.4;}\n        .cluckybot-container .msg-bot { background: #3498db; color: white; align-self: flex-start; border-bottom-left-radius: 0;}\n        .cluckybot-container .msg-bot-warn { background: #e67e22; color: white; align-self: flex-start; border-bottom-left-radius: 0;}\n        .cluckybot-container .msg-user { background: #2ecc71; color: white; align-self: flex-end; border-bottom-right-radius: 0;}\n        .cluckybot-container .chat-input-area { display: flex; gap: 10px; margin-top: 15px; }\n        .cluckybot-container .chat-input-area input { flex: 1; padding: 10px; border-radius: 5px; border: 1px solid #bdc3c7; font-size: 16px;}\n        .cluckybot-container .btn-safe { background: #13c2c2; border: none; padding: 12px 20px; color: white; cursor: pointer; border-radius: 5px; font-weight: bold; font-size: 16px; margin: 0; transition: background-color 0.2s;}\n        .cluckybot-container .btn-safe:hover { filter: brightness(1.1); }\n    <\/style>\n\n    <div class=\"cluckybot-container\">\n        <h2 style=\"margin-top: 0;\">2. Trial Run: Train CluckyBot \ud83d\udc14<\/h2>\n        <div class=\"lesson-box\">\n            <h4 style=\"margin-top:0; margin-bottom:5px;\">\ud83d\udcd6 What are we learning?<\/h4>\n            <p style=\"margin:0;\">&#8220;An AI system can only do what it has been programmed or trained with data to do.&#8221; It learns from humans!<\/p>\n        <\/div>\n        <p>Before you build your own chatbot in Scratch, try training this one. Clucky&#8217;s AI brain is completely empty right now. Chat with him. If he doesn&#8217;t know the answer, he will ask you to teach him. See how quickly he learns!<\/p>\n        \n        <div class=\"chat-window\" id=\"chatWindow\">\n            <div class=\"chat-msg msg-bot\">Bawk! I am CluckyBot. My brain is empty. Say &#8220;Hello&#8221;!<\/div>\n        <\/div>\n        <div class=\"chat-input-area\">\n            <input type=\"text\" id=\"chatInput\" placeholder=\"Type your message here...\" onkeypress=\"handleChat(event)\">\n            <button class=\"btn-safe\" onclick=\"processChat()\">Send<\/button>\n        <\/div>\n    <\/div>\n\n    <!-- Main Activity Box -->\n    <div style=\"background-color: #fffbe6; padding: 20px; border-radius: 10px; margin-bottom: 20px; border: 1px solid #ffe58f;\">\n        <h2 style=\"margin-top: 0;\">3. Build your Chickbot! \ud83d\udcbb<\/h2>\n        <p>In this session, we will be using Scratch to create our very own AI chatbot. Put on your headphones so you can follow along with the video below.<\/p>\n        \n        <p><strong>Top Tip:<\/strong> Pause the video after each instruction so you know what you are doing, and rewind if you make a mistake!<\/p>\n        \n        <!-- Video Embed -->\n        <div style=\"position: relative; padding-bottom: 56.25%; height: 0; overflow: hidden; max-width: 100%; background: #000; border-radius: 8px; margin-bottom: 20px;\">\n            <iframe style=\"position: absolute; top: 0; left: 0; width: 100%; height: 100%;\" src=\"https:\/\/www.youtube.com\/embed\/pdyk7tmVz9I\" title=\"YouTube video player\" frameborder=\"0\" allow=\"accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share\" referrerpolicy=\"strict-origin-when-cross-origin\" allowfullscreen=\"\"><\/iframe>\n        <\/div>\n        \n        <h3 style=\"margin-top: 20px;\">4. Open Scratch and Save \ud83d\udcbe<\/h3>\n        <p>Click below to open Scratch and start coding. When you are finished today, remember to save your work to your OneDrive so it does not get lost!<\/p>\n        <a href=\"https:\/\/scratch.mit.edu\/\" target=\"_blank\" style=\"display: inline-block; background-color: #fa8c16; color: white; padding: 12px 24px; text-decoration: none; border-radius: 8px; font-weight: bold; margin-top: 10px;\">\ud83d\udc31 Open Scratch<\/a>\n    <\/div>\n\n    <!-- Plenary Box -->\n    <div style=\"background-color: #fafafa; padding: 20px; border-radius: 10px; border: 1px solid #d9d9d9;\">\n        <h2 style=\"margin-top: 0;\">5. Class Reflection \ud83d\udde3\ufe0f<\/h2>\n        <p>We will recap the lesson together. Get ready to share your screen with the class so we can look at your progress or talk through any issues you had with your code!<\/p>\n    <\/div>\n\n    <!-- JavaScript for CluckyBot -->\n    <script>\n        (function() {\n            let cluckyBrain = {};\n            let waitingForAnswer = false;\n            let pendingQuestion = \"\";\n\n            window.handleChat = function(e) { \n                if(e.key === 'Enter') processChat(); \n            };\n            \n            window.processChat = function() {\n                let inputEl = document.getElementById(\"chatInput\");\n                let input = inputEl.value.trim();\n                if(input === \"\") return;\n                inputEl.value = \"\";\n                \n                let cw = document.getElementById(\"chatWindow\");\n                cw.innerHTML += `<div class=\"chat-msg msg-user\">${input}<\/div>`;\n                \n                setTimeout(() => {\n                    if(waitingForAnswer) {\n                        cluckyBrain[pendingQuestion] = input;\n                        cw.innerHTML += `<div class=\"chat-msg msg-bot\">Bawk! I learned it. If you say \"${pendingQuestion}\", I will say \"${input}\". Ask me something else!<\/div>`;\n                        waitingForAnswer = false;\n                    } else {\n                        let cleanInput = input.toLowerCase();\n                        \/\/ Strip punctuation for easier matching\n                        cleanInput = cleanInput.replace(\/[^\\w\\s\\']|_\/g, \"\").replace(\/\\s+\/g, \" \");\n                        \n                        if(cluckyBrain[cleanInput]) {\n                            cw.innerHTML += `<div class=\"chat-msg msg-bot\">${cluckyBrain[cleanInput]}<\/div>`;\n                        } else {\n                            cw.innerHTML += `<div class=\"chat-msg msg-bot-warn\">I don't know that pattern yet! What should I reply when you say \"${input}\"?<\/div>`;\n                            pendingQuestion = cleanInput;\n                            waitingForAnswer = true;\n                        }\n                    }\n                    cw.scrollTop = cw.scrollHeight;\n                }, 600);\n            };\n        })();\n    <\/script>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\ud83d\udc25 Session 3: Programming the Chickbot \ud83d\udca1 Key Words Today Chatbot: A computer program designed to have a conversation with human users. Code: The instructions&#8230;<\/p>\n<div class=\"more-link-wrapper\"><a class=\"more-link\" href=\"https:\/\/ndovu.org.uk\/cs\/term-1-13-training-the-chickbot\/\">Continue Reading<span class=\"screen-reader-text\">Yr4 Term 1.13 Training the chickbot<\/span><\/a><\/div>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[7],"tags":[],"class_list":["post-288","post","type-post","status-publish","format-standard","hentry","category-year4","entry"],"_links":{"self":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/288","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/comments?post=288"}],"version-history":[{"count":5,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/288\/revisions"}],"predecessor-version":[{"id":526,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/posts\/288\/revisions\/526"}],"wp:attachment":[{"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/media?parent=288"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/categories?post=288"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ndovu.org.uk\/cs\/wp-json\/wp\/v2\/tags?post=288"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}