<p>I have done this, but a bit different.</p>

<p>I introduced them to <em>Teacher Robot</em>. Then got them to give instruction to make the sandwich. As they improved at being an instructor, I improved at being a robot (that is following instructions, not interpreting instructions, so making more mistakes). </p>

<p>After everyone had contributed, and we had attempted 3→4 sandwiches. I called for a volunteer to be the robot. We then repeated the exercise. I did this for 2 or 3 students. </p>

<p>As part of the instruction, I tell students that the volunteer robots are more intelligent than real robots, but not all fictional robots. These robots must not do anything dangerous, and will not do anything that they feel uncomfortable with. I also whisper tips to the robots, on how to get it wrong (“Just do what they say.”, “If there is more than one way to interpret what you are told, then choose the wrong one.”.</p>

<p>There is a good <a href="http://csunplugged.org/" rel="nofollow noreferrer">CS-Unplugged</a> on this: see video example <a href="https://www.youtube.com/watch?v=6iPfSIxrP18" rel="nofollow noreferrer">https://www.youtube.com/watch?v=6iPfSIxrP18</a>.</p>

CC BY-SA 3.0
2017-10-18T04:54:34.003Z
Simple, but I like it!  What better way to show the difficulties that students might otherwise gloss over?
Dave I
CC BY-SA 3.0
2017-10-17T08:40:56.090Z
2017-10-17T08:40:56.090Z
ctrl-alt-delor
<p>I think the "peanut butter jelly sandwich challenge" is a great lesson in general, but it's especially great for computer science. Kudos.</p>

<p>That being said, I think you might be conflating two separate topics that are each worth their own lessons:</p>

<ul>
<li><p>The exactness of <strong>syntax:</strong> <code>take rightHand plate</code> and <code>take plate rightHand</code> are two different things, and a computer might not be able to understand what you mean.</p></li>
<li><p>The exactness of <strong>semantics:</strong> <code>take plate rightHand</code> might sound like an obvious instruction to a human, but that's because we've had years of practice picking up plates with our hands. But a computer hasn't had that practice! What if it tries to pick up the plate with a fist? What if it tries to grab a plate by the middle instead of by the edge? So often our instructions to a computer have to be much more detailed than we first thought.</p></li>
</ul>

<p>The "semantic exactness" part is the real beauty of the peanut butter jelly sandwich challenge, imho. One of the hardest things to do in computer science is take things that humans "just do" and break them down into individual steps. If they continue exploring CS, your students will eventually have to ask questions like <em>"how would I sort a stack of index cards with numbers written on them?"</em>, and their initial reaction will be <em>"I don't know, I just do it!"</em>. The peanut butter jelly sandwich challenge teaches them to dig a little deeper than that first reaction, and to start breaking things down into smaller steps.</p>

<p>And the fun part is that no matter how exact students make their instructions, you can always find a way to get it wrong.</p>

<p>Anyway, back to your actual question: I would propose a three-part lesson:</p>

<ul>
<li><p><strong>Step one:</strong> Have students come up with "programs" that they enter into your engine. This might be a homework assignment. This teaches them the "syntactic exactness" part, and gets them thinking about breaking things down into smaller steps.</p></li>
<li><p><strong>Step two:</strong> In class, have students volunteer to read off their programs. You follow their instructions, pointing out as many inconsistensies as you want, in as messy a way as you want. After a few examples, take a step back and give them the lesson that even if your <strong>syntax</strong> is valid, sometimes your <strong>semantics</strong> can be unclear. Then maybe have them abandon your syntax and give you instructions in English, that way they can be more specific about each step. But like I said before, no matter how exact their instructions are, you can still find a way to get it wrong.</p></li>
<li><p><strong>Step three:</strong> After a few rounds of this, have students break off into pairs: one student giving instructions, one following them and getting it wrong in the same way you did. Whether you give them real ingredients or tell them to pretend they have real ingredients is up to you and how much of a mess you want to clean up afterwards.</p></li>
</ul>

CC BY-SA 3.0
2017-10-18T04:57:30.640Z
I agree this is a very important point, and I will use it to deepen the exercise during the teacher (me) demonstration stage.  Thanks!
Dave I
CC BY-SA 3.0
2017-10-16T22:28:07.113Z
2017-10-16T22:28:07.113Z
Kevin Workman
<h2>Peanut Butter and Jelly Ending</h2>

<p>I have a task that I started with a group of 4th-6th graders at the beginning of a short course on Artificial Intelligence.  In order to demonstrate how <em>exact</em> computers are about their instructions, I've created a strict syntax for a fictional robot and a series of environmental specifications.  The students must use the syntax provided (in something resembling an API) to generate commands that the Robot will ultimately use to create a Peanut Butter and Jelly Sandwich.<sup>*</sup></p>

<p>I've also created a little engine that can run this all at the command prompt, and gives back useful errors if the students either generate a syntax error (ie. <code>take rightHand plate</code> instead of <code>take plate rightHand</code>) or attempts an illegal action (such as <code>take plate rightHand</code> when <code>rightHand</code> is already full).  I have not yet given them access to the engine; they spent the last 15 minutes of the previous period trying to generate a full set of working instructions from the specification, and they had a lot of fun doing it!</p>

<p>I have a vague notion about what will come next; I want to integrate allowing them to copy/paste their instructions into the engine to see if they have run into trouble, and creating an actual PB&amp;J sandwich (or whatever components of that sandwich they've actually managed to make.)  I have already checked about allergies to peanuts, so we should be safe there.</p>

<p>What I don't quite see is how to integrate those two activities so that it won't get bogged down.  If <em>I</em> enact the PB&amp;J creation faithfully, I won't be able to do it for every child.  If I ask <em>them</em> to create it, they might just change their commands as soon as they see an error, which would let everyone get a sandwich, but wouldn't be as fun.</p>

<p>The lesson has had a great start.  How can I finish it up to make it into a home run?</p>

<p><sup>*</sup> - I know that folks in some countries don't eat Peanut Butter and Jelly sandwiches. That's fine as far as it goes, but please know that you are wrong.<sup>*</sup><sup>*</sup></p>

<p><sup>*</sup><sup>*</sup> - Unless of course you are allergic to peanuts.</p>

CC BY-SA 3.0
2017-10-20T08:29:02.847Z
We have peanut and jam sandwiches. In English Jelly is the wobbly edible non-food stuff, that is eaten at children's parties.
ctrl-alt-delor
<lesson-ideas><student-motivation>
Peanut Butter and Jelly Ending
# Peanut Butter and Jelly Ending

(Asked by: username_0 on 2017-10-16)

## Peanut Butter and Jelly Ending

I have a task that I started with a group of 4th-6th graders at the beginning of a short course on Artificial Intelligence. In order to demonstrate how *exact* computers are about their instructions, I've created a strict syntax for a fictional robot and a series of environmental specifications. The students must use the syntax provided (in something resembling an API) to generate commands that the Robot will ultimately use to create a Peanut Butter and Jelly Sandwich.\*

I've also created a little engine that can run this all at the command prompt, and gives back useful errors if the students either generate a syntax error (ie. `take rightHand plate` instead of `take plate rightHand`) or attempts an illegal action (such as `take plate rightHand` when `rightHand` is already full). I have not yet given them access to the engine; they spent the last 15 minutes of the previous period trying to generate a full set of working instructions from the specification, and they had a lot of fun doing it!

I have a vague notion about what will come next; I want to integrate allowing them to copy/paste their instructions into the engine to see if they have run into trouble, and creating an actual PB&J sandwich (or whatever components of that sandwich they've actually managed to make.) I have already checked about allergies to peanuts, so we should be safe there.

What I don't quite see is how to integrate those two activities so that it won't get bogged down. If *I* enact the PB&J creation faithfully, I won't be able to do it for every child. If I ask *them* to create it, they might just change their commands as soon as they see an error, which would let everyone get a sandwich, but wouldn't be as fun.

The lesson has had a great start. How can I finish it up to make it into a home run?

\* - I know that folks in some countries don't eat Peanut Butter and Jelly sandwiches. That's fine as far as it goes, but please know that you are wrong.\*\*

\*\* - Unless of course you are allergic to peanuts.

**Tags:** lesson-ideas, student-motivation

> **Comments:**
> **username_1**: We have peanut and jam sandwiches. In English Jelly is the wobbly edible non-food stuff, that is eaten at children's parties.  

---

## 2 answers

### Answer by username_2 on 2017-10-16. Score: 4

I think the "peanut butter jelly sandwich challenge" is a great lesson in general, but it's especially great for computer science. Kudos.

That being said, I think you might be conflating two separate topics that are each worth their own lessons:

* The exactness of **syntax:** `take rightHand plate` and `take plate rightHand` are two different things, and a computer might not be able to understand what you mean.
* The exactness of **semantics:** `take plate rightHand` might sound like an obvious instruction to a human, but that's because we've had years of practice picking up plates with our hands. But a computer hasn't had that practice! What if it tries to pick up the plate with a fist? What if it tries to grab a plate by the middle instead of by the edge? So often our instructions to a computer have to be much more detailed than we first thought.

The "semantic exactness" part is the real beauty of the peanut butter jelly sandwich challenge, imho. One of the hardest things to do in computer science is take things that humans "just do" and break them down into individual steps. If they continue exploring CS, your students will eventually have to ask questions like *"how would I sort a stack of index cards with numbers written on them?"*, and their initial reaction will be *"I don't know, I just do it!"*. The peanut butter jelly sandwich challenge teaches them to dig a little deeper than that first reaction, and to start breaking things down into smaller steps.

And the fun part is that no matter how exact students make their instructions, you can always find a way to get it wrong.

Anyway, back to your actual question: I would propose a three-part lesson:

* **Step one:** Have students come up with "programs" that they enter into your engine. This might be a homework assignment. This teaches them the "syntactic exactness" part, and gets them thinking about breaking things down into smaller steps.
* **Step two:** In class, have students volunteer to read off their programs. You follow their instructions, pointing out as many inconsistensies as you want, in as messy a way as you want. After a few examples, take a step back and give them the lesson that even if your **syntax** is valid, sometimes your **semantics** can be unclear. Then maybe have them abandon your syntax and give you instructions in English, that way they can be more specific about each step. But like I said before, no matter how exact their instructions are, you can still find a way to get it wrong.
* **Step three:** After a few rounds of this, have students break off into pairs: one student giving instructions, one following them and getting it wrong in the same way you did. Whether you give them real ingredients or tell them to pretend they have real ingredients is up to you and how much of a mess you want to clean up afterwards.

> **Comments:**
> **username_0**: I agree this is a very important point, and I will use it to deepen the exercise during the teacher (me) demonstration stage.  Thanks!  

---

### Answer by username_1 on 2017-10-17. Score: 3

I have done this, but a bit different.

I introduced them to *Teacher Robot*. Then got them to give instruction to make the sandwich. As they improved at being an instructor, I improved at being a robot (that is following instructions, not interpreting instructions, so making more mistakes).

After everyone had contributed, and we had attempted 3→4 sandwiches. I called for a volunteer to be the robot. We then repeated the exercise. I did this for 2 or 3 students.

As part of the instruction, I tell students that the volunteer robots are more intelligent than real robots, but not all fictional robots. These robots must not do anything dangerous, and will not do anything that they feel uncomfortable with. I also whisper tips to the robots, on how to get it wrong (“Just do what they say.”, “If there is more than one way to interpret what you are told, then choose the wrong one.”.

There is a good [CS-Unplugged](http://csunplugged.org/) on this: see video example <https://www.youtube.com/watch?v=6iPfSIxrP18>.

> **Comments:**
> **username_0**: Simple, but I like it!  What better way to show the difficulties that students might otherwise gloss over?  

---

