Task Build a Chat bot What is a Chat Bot? http://www.elbot.com/ Hi Human! My name is ELBOT and I’m a Chat Bot. Click my red button to activate me! Are allelbot.com you humans thisand slow! Visit fuse? typeHave to you talkblown to ahim? Seriously! Are you afraid? Come on Click Find me another human this me! one is faulty! Chat bots look like they have some intelligence to them. But, in reality Hmm ! Well I think I’m their conversations smarter than a human… Have you met my cousin are just a lot of clever Siri? If humans’ are so smart why do they always ask us computers daft pre-programmed questions? Do I look like I know what responses to the fox say’s? But I bet if you ask Siri he’ll know… anticipated inputs.. What is an input? Any information or data that's entered or sent to the computer to be processed is considered input. Input or user input is most often sent to the computer using an input device such as a keyboard or mouse. What is an output? An output is anything where information comes out of the computer. Printouts are called Hard copy soft copy is viewed on sc Soft copy is a copy of text stored on the computer and only accessible through the computer. The most common method of displaying a soft copy is through a computer monitor or other display. We are going to try make the user feel like they are having a conversational dialogue “chat” with the computer. To do this we will need to get and store some personal information. We are going to need a container In the computers memory to store the name of the users name. Lets create a VARIABLE , this memory container needs a sensible name.. How about 1 We don’t know the name yet so leave this TEXT block empty. We’ll need a greeting! Create a new variable 2 Add a suitable welcome like this one. TOP TIP Put a space after the word YOU https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#629t4p Lesson 1 Video link optional Teacher example components link Chat bots need INPUT Call up the User name variable Get INPUT Type a polite question. Hi, im ROBOT ROB. What’s your name? 3 Now add the PRINT block. This will display the Username on screen 4 Chat bots give OUTPUT 5 Link your blocks and run your program Simple Chat bot greeting. Challenge • Your program should now look like this. Did you follow the instructions carefully to make the first stage? Lesson 2 In our next lesson we are going to make a routine which will do some counting and will output a message to the user which will make the chat bot appear intelligent. Task- Now create a procedure called chat bot. Place your code inside the procedure. Remember to include the procedure call command. Lesson 2 Video time 0.15.30 (roughly the middle of the slider) link Load last lessons program. https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#2qg93k Extension What should we do if the user behaves in an unexpected way. Lets say the user does not enter a name that is sensible. It would be difficult to write a set of instructions to spot that the name is invalid. The program would respond – Hello ksfuhdsakfjhaskfj nice to meet you! But what would happen if the user didn’t type anything but just pressed enter. Our program would say Hello nice to meet you! Have a look at Elbot and try presing enter. https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#2qg93k Extension What did Elbot do? Elbot gives a cheeky message, “oi type louder! I can’t hear you!” Elbot must be using an array to store these messages Messages must be called for using a random command like the one we used in the blockly minecraft task. Challenge task. Using the Minecraft code to help you. Create a routine (algorithm) that checks to see if no data was NO entered gives a random cheeky comment. data –and look at elbot no data entered https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#2qg93k The slides after this point are work in progress and labels to help explain append. • Class activity using a gratnell talk through what a variable is and the main types • • • • String Integers Floats Array - lists Nice to meet you FRED ! FRED Did you know that your name is 4 Characters long APPEND add (something) to the end of a something. synonyms: add, attach, affix, adjoin, include, put in/on; With numbers append really means add e.g. Variable_X = 1 Varibale_Y=2 Variable Z= 0 Variable Z = X APPEND Y = 3 Print Variable_Z So variable Z == 3 Variables and append demonstrated https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#2qg93k COUNT https://blockly-demo.appspot.com/static/apps/code/index.html?lang=en#2qg93k Advanced While true LOOPS No input Multiple random comment no data entered! https://blocklydemo.appspot.com/static/apps/code/index.html?lang=en#n g4hhe String Variable (text) UserName String Variable (text) Greeting String Variable (text) NameLength String Variable () NameLengthComment