As part of our series on teaching code at home, we ran a presentation at the May LeicesterJS webinar.
We spoke through the learning journey that children could take to develop the skills for writing algorithms, and demonstrated a fun and easy activity to try at home called the "Jam Sandwich robot".
This is a highly educational and informative talk 🤖 Shoutout to Jessica Whitelock / @stacsolutions for "If I were five how would I solve this problem?" pic.twitter.com/82jBC5btcB
— LeicesterJS (@leicesterjs) May 21, 2020
In this activity the adult acts as the jam sandwich robot, and the children have to give the adult instructions to make a jam sandwich. The learning points are that the robot cannot think for itself. It cannot use it's brain to interpret what the instructions mean, so the children need to make sure that the instructions are exact, and in the right order. A very visual way for children to see what happens when there is a bug in their algorithm, which always leads to hilarity!
Working as a team at the LeicesterJS meet, we wrote our code for the jam sandwich robot:
//Start here
function BuildJamSandwich() {
//TODO Build Jam Sandwich
WashHands(HAPPYBIRTHDAY.length);
GetBread();
if (bread == wrapped) {
GetBreadOutOfPacket(2);
}
GetKnifeByHandle();
if (knife == dirty) {
WashKnife();
}
if (Environment.IS_BUTTER_ENABLED) {
GetButter();
OpenButter(DELID);
while (butterspreadevenly) {
GentlySpreadButter(SlicedBread);
}
}
GetJam();
OpenJam(UNSCREW);
while (jamspreadevenly) {
GentlySpreadJam(SlicedBread.surface);
}
GetSliceTwo();
ApplyBread(slice1, slice2);
DipBreadInJam();
InsertBreadInFace();
//Jerome loves Jam
}
BuildJamSandwich();
console.log("Well done! You tried!");
Judge for yourself how well it went from the screenshots below!
We are at the pinnacle of artificial intelligence. pic.twitter.com/YoqyPxQ3Gt
— LeicesterJS (@leicesterjs) May 21, 2020
Ordinarily, I would let the children give verbal instructions for their robot, we used this method to make it more appropriate for an adult audience. The children would also be allowed to fix the bugs in their program and run the jam sandwich robot until they were happy with the results. A great activity to try at home!
Slides Here