BYU Home pageBRIGHAM YOUNG UNIVERSITY
  Humanities Technology and Research Support Center
Back     CHum LiveCode Gateway

CHum 210
Exercise: Controlling the Robot

20 points (Due next class period)

You are the supervisor of a manufacturing facility whose job is to build stacks of colored disks according to the specifications given by the client. Here is the current order:

Because the disks are too heavy for a person to lift (and you are the only worker in the plant), the company has provided a robot to do the lifting and moving for you. Remarkably, the floor of your plant is laid out in the same configuration as our classroom. (See the layout diagram.)

Your robot understands a few simple commands and can sense a few facts about its environment. Here is how to direct your robot:

Here are the rules for giving the robot its instructions:
Your set of instructions must be structured like this:
tell robot to
[The entire set of instructions
Should go between brackets
One command per line
Like this]

Once the instructions begin, the robot should complete the entire task, then stop in the place it began, facing the direction it faced at the start.

The robot can only lift one disk at a time.

It understands the following commands:

Command What it does
turn right turns right 90°
turn left turns left 90°
turn 180 turns 180°
step forward|back|right|left takes 1 step in the direction indicated without changing the direction its facing
take disk attempts to picks up a disk (but only succeeds if it is at the stack of disks, facing it)
set disk sets the disk down (if it is at the destination stack, facing it, robot will set the disk on top of the stack.)
walk starts moving in the direction it is facing
stop stops the walk command

It can sense the following things and respond if the condition is true:
if the next [right|left|forward] step is [not] a solid barrier|a pile of disks (yes or no)
 [command 1
  command 2
  command 3
  etc.]

if it is carrying a disk (yes or no)

You can use the following constructs to group sequences of commands:

do N times
 [command 1
  command 2
  command 3
  etc.]
as many commands as you want can be listed between the brackets. Each command will be executed, in the order listed N number of times (N is a whole number.)
do until
 [command 1
  command 2
  command 3
  etc.]
For example, you could tell the robot:
do until the next step is a solid barrier
[step forward]

Grading

The commands provided should be sufficient to complete the task. You may not need to use all of the commands, however. There is more than one correct solution. Solutions will be judged according to these criteria:

1. It completes the task correctly.
2. The instructions are efficient, using as few lines as possible and avoiding extraneous movement.
3. The instructions are clear to the reader.


Factory Layout Diagram:

Factory layout diagram

Click image for full-sized view.

Back     CHum LiveCode Gateway
Maintained by Devin Asay.
Copyright © 2005 Brigham Young University