Provide the quote:
‘Thy bones are marrowless, thy blood is cold
Thou hast no speculation in those eyes’
Have students guess which literature character said those words. (Lady Macbeth)
Lady Macbeth is a character from Shakespeare that students may be familiar with through studies of English literature.
In programming we can use this context to create a chatbot that responds to a user’s text input in a style that would reflect the Lady Macbeth character. To acheive this, we will be using the pencil code program new.pencilcode.net
Ask students to recall particular scenes or quotes from the famous Shakespeare play. To refresh students’ memory use this study guide Lady Macbeth.
Provide students with the chatbot pencil code program. Copy/Paste the program into a ‘Blank Editor’ on the Pencil Code website (new.pencilcode.net).
Explore how the chatbot responds to particular text inputs.
Can you work out what words the chatbot will respond to?
Have students analyze or fill in or change parts of the pencil code program.
Ways to remix the program
How well did the pencil program work?
What changes or modifications did you make?
How well did these changes work?
|Abstraction||Identifying and extracting relevant information to define main idea(s)|
|Pattern Recognition||Observing patterns, trends, and regularities in data|
* Explore the Computational Thinking Concepts Guide for a list of the CT concepts noted on ECT, including tips for implementing each concept in your classroom.
Copy/Paste the following program into a ‘Blank Editor’ on the Pencil Code website (new.pencilcode.net)
# Copyright 2015 Google Inc. All Rights Reserved. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # http://www.apache.org/licenses/LICENSE-2.0 # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. replyto = (words) -> for word in words switch word when "hello" return "Hello. I'm waiting." # For example, if asked "Who are you?" when "name", "who" return "Lady Macbeth." # E.g.: "Have you heard about the murder?" when "power", "kill", "duncan", "murder", "king" return """ I love power. I will do anything for power. """ when "prophecy" , "prophesy" , "prophesies" return """ I think the prophesies are true, but I think that we have to make them come true. We can't just rely on fate. We have to take matters into our own hands. """ when "witches", "fair", "foul" return """ They say that Fair is foul, and foul is fair, and I agree. """ when "blood", "hand" return """ All we have to do is wash our hands of it. """ when "plan", "idea", "plans", "plot" return """ All we have to do is wash our hands of it." """ return random [ "Are you a man?" "Was hope drunk wherein you dressed yourself?" "Only look up clear. To alter favor ever is to fear. Leave all the rest to me." ] while true await readstr "Ask me anything.", defer t words = t.toLowerCase().split /[\s\.,!?]+/ write replyto words