Supplemental Material for Baldwin and Scragg, Algorithms and Data Structures: The Science of Computing; Charles River Media, 2004 (Now published by Cengage Learning)
This lab provides direct experience with the design and conduct of rigorous experiments in computer science. In doing this, it helps students understand what the experimental process involves, and the challenges of doing it well.
Understanding of Chapter 4 of Algorithms and Data Structures: The Science of Computing.
When one of the robots introduced
in
Chapter
2 of Algorithms
and Data Structures: The Science of Computing receives a move
message,
it does one of two things: either the tile in front of the robot is unobstructed
and the robot
moves
forward,
or
the tile is obstructed and the robot flashes to indicate a collision. Both
of these
responses
take
a noticeable amount of time. This lab involves doing an experiment
motivated
by
the question “which
takes longer?”
Good experiments generally require more thought and care than it seems at first. Chapter 4 of Algorithms and Data Structures: The Science of Computing discusses some of the issues that arise in computer science experiments. Sections 4.5 and 4.7, on mathematical tools for controlling and estimating error, and measuring time in Java, respectively, may be particularly useful in this exercise.
The robot is available as a Java class named Robot
(and
a supporting class named RobotRoom
). Programs that
use these classes need to include two Java files: Robot.java and RobotRoom.java.
The “Final
Details” section
of this document explains how to find these files and their documentation.
Any Java source file that refers to the Robot
or RobotRoom
classes
should “import” those classes, via the statement
import geneseo.cs.sc.*;
at the beginning of the file.
Based on informal observations of the robots, intuitions about whether hitting
walls or moving freely should be faster, or other criteria, suggest a hypothesis
about whether it is faster for a Robot
object to handle a move
message
when the robot is free to move, or when the robot is obstructed. Then design,
carry out,
and report on an experiment that tests this hypothesis. (Note that the important
thing about this exercise is the process of doing the experiment, not whether
the hypothesis is right or wrong.)
All experiments follow the same general outline (hypothesis, prediction, procedure, data analysis, conclusions, etc.), but some elements of that outline merit particular note in this experiment:
move
message. The independent
variable isn’t quite so obvious, but (depending on the prediction)
will probably be whether the robot is obstructed or unobstructed (in effect,
a
Boolean
independent
variable).Both Robot.java and RobotRoom.java can be downloaded from the Web.
Documentation on both classes is also available on the Web. The main documentation page is an index to documentation for all the Java classes written for use with Algorithms and Data Structures: The Science of Computing. To see the documentation for a specific class, click on that class’s name in the left-hand panel of the page.
Turn in a lab report describing your experiment. Format and submit this report as directed by your instructor.
Copyright © 2004 Charles River Media. All rights reserved.
Revised Aug. 8, 2005 by Doug Baldwin