CMPSCI 377: Operating Systems
Lab 1: Java Refresher
Due: Sept 26, 2002 23:59
Purpose of Assignment
This assignment is intended to bring you up to speed on the
subset of Java you will need for this course (if you do not have it
yet). Anyone who cannot finish this assignment on time does not
have the necessary programming skills to complete this course successfully,
and should drop the course. Since the assignment is not really related
to operating systems, it will only count for 10% of your lab grade.
Programing for this lab may be done using the Computer Science
Ed Lab workstations,
which run Java under JDK.
Every student in CMPSCI377 has an edlab account; the
default username for the account is the first letter of your first name
followed by your last name; if your name is Allen Roberts, for example,
your username would be aroberts. The default password is your student
ID number. If you have trouble accessing your account, please ask the
monitor. If you are logging in remotely, you should use
Where to do your work
You should do all of your work for this class in the following directory:
where UID is your username. Please make sure that you protect your directory from prying eyes:
chmod o-rwx /courses/cs300/cs377/UID/
But make sure that we can get to your directory:
chmod g+rx /courses/cs300/cs377/UID/
For this lab, place your final submission in the following directory:
chmod g+rx /courses/cs300/cs377/UID/lab1
If your files are not located in the right place or our robot cannot read
your homework at the time of submission, then we will not be able to
grade it (don't worry, we will do some checks before the deadline).
In order to use java, make sure that the following line has been added to your
set path = ($path /exp/rcf/share/X11R5/jdk/bin/)
For lab 2, we will be solving a problem involving multiple,
coordinated robots (with which we will study threads and
synchronization). In short, there will be some set of robots of
various colors (red, green, and blue), and some set of goals (red,
green, blue, and black). The robots and goals will "live" on a
discrete grid of a specific size (think graph paper). Some grid squares
will be occupied by obstacles. In lab 2, the task will be for the individual
robots to move around on the grid and "eat" goals without running into
each other or any obstacles.
We will prepare for lab 2 here by performing two of the initial steps.
First, we will parse a file that contains information about where
the robots, goals, and obstacles are located. This file name will
be specified as the first command-line parameter. Second, we will
display a map of this world within a window.
Here is one example file:
The elements of this file are as follows:
- A line specifying the size of the grid (NROWS, NCOLS).
- NROWS lines specifying the obstacles for each grid cell (1=obstacle;
- A line specifying the number of robots (N).
- N lines specifying the initial position and color
of the robot (ROW, COL, and r/g/b) (red/green/blue).
Note that 0,0 corresponds to the top-left grid square of the world.
- A line specifying the number of goals (M).
- M lines specifying the position and color of the goals (ROW, COL, r/g/b/k) (k corresponds to black).
Your program must parse this file and place the information into an
appropriately-designed datastructure. Your program should detect
and trap any errors that might exist in the file and display an
appropriate error message.
The output is a map of the grid that shows the obstacles, robots, and goals.
Here is an example that corresponds to the map file above:
Here, goals are shown as triangles and robots are shown as "Pac-Men".
What to Hand In
Everyone must hand in their own work for this lab (in later labs,
you will be able to work in pairs).
Place in your Hand-In directory the following:
- An appropriately documented java source file (e.g., "lab1.java")
- An executable that you have compiled for and tested on the elnux
system. We will test this executable using shell
commands similar to the following: "
java lab1 map1.txt"
- A "README" file (raw ASCII format) that contains:
- Your name
- Your UID
- The name of your executable
We will test your program with a variety of maps, including:
Your program should produce an appropriate map for the first three
files; and appropriate error messages for the last three files.
This lab is worth 10% of your lab grade (so 3.9% of your final grade).
This grade will depend on:
- Program Design (including datastructures): 25%
- Program Implementation: 25%
- Correctness: 30%
- Documentation: 20%
This page is online at http://www-all.cs.umass.edu/~fagg/classes/377/labs/lab1/index.html
Andrew H. Fagg