EECS 183 Labs

EECS 183 Lab 1: Algorithms

Lab due on your scheduled lab day

Lab accepted for full credit until Tuesday, September 3rd, 11:59 pm Eastern

In this lab assignment, will write an algorithm to make a sunflower butter and jelly sandwich. While working on the lab, you will learn some of the tools you need to master the course beginning with Project 1.

Learning Objectives

Students should be able to identify that developing successful algorithms requires them to know the following:

Key Concepts

Assignment

Your task for this lab is to write an algorithm to make a sandwich. You should approach this problem by assuming that your algorithm will be given as a set of instructions to a robot that does not understand what a sandwich is. That is, your algorithm should be taken literally and still be able to produce an edible sandwich.

Complete this lab in a group with 2-3 others. Find a way to write your algorithm somewhere everyone can contribute – whether a piece of paper, a Google Doc, or a laptop everyone can see. You will submit a text copy of your algorithm using the link above.

How to write an algorithm

An algorithm is a series of steps used to solve a problem. An algorithm can be written in a different language, but it must contain the steps required to solve the problem. You could write an algorithm using English (or any) language prose. However, it is more helpful to write an algorithm using pseudocode or alternately using a flowchart. Pseudocode is an informal description of an algorithm.

Write an algorithm for the problem using the pseudocode from the lecture and lab as a guide. There is no universal pseudocode, and yours may look a little different.

Here is an example of pseudocode for making a sandwich. However, this is nowhere near as detailed as you will need to be.

Starter Sandwich Algorithm

  1. Take a slice of bread.
  2. Put sunflower butter on the bread.
  3. Put jelly on the bread.
  4. Take another slice of bread.
  5. Put the second slice of bread on the first.

Here’s a picture of a sandwich made with this algorithm, which will hopefully explain why you need to be more detailed!

Test Your Algorithm

If someone in your team has immediate access to the materials, try to execute the steps of the algorithm. Otherwise imagine going through the steps, preferably using other objects to represent the items needed. Be as literal as possible in following the steps of your algorithm – try to make the silliest sandwich that literally follows the instructions. Test each part of your algorithm as you progress: preparing the bread before moving on to sunflower butter, applying sunflower butter before moving on to jelly, etc.

Grading

10 points for completion.

Implement your algorithm and submit it with the lab form. Does your algorithm implement the features required by this specification? Would another person who has never made a sandwich be able to follow your detailed instructions?

Submission

When your team has completed your algorithm, each person must submit the following Google form to receive credit for the lab. Your team can and would be expected to submit the identical algorithm developed as a team.