CIS 636 Fall 2002 Assignment 6 – Simple Threads in Java 100 points
Assigned: 11/04/2002
Due: 11/18/2002 at the start of class
You may work
individually or in pairs for this assignment. But all work must be the work of
the person/people whose name is on the code! If working in pairs, the
individual contributions should be relatively equal. One possibility is to work
together tonight, then finish separately (to avoid communication difficulties).
Main Assignment:
We are going to use related but unsynchronized threads to
work in (sort of) parallel on a problem. The task involves rating chess boards
for how good they are for a player. The task will be divided up among threads
so that each thread works on a particular row of the board (hence on a particular
array of chess pieces). Each thread will calculate the rating for the row that
it is responsible (store the result as an instance variable in the class that
you create). You have been provided a ChessPiece class (see my WWW page) that
you can make use of. We are working
with a very simple rating scheme, like a child might use (my level of chess
expertise !!). Each color is rated just based on the ratings of its remaining
pieces. See getValue for piece ratings. You task is two write main that 1)
kludges together a board setup to allow testing your other work; 2) starts a
thread for each row, 3) retrieves the results from each thread, and 4) produces
final summary results. You may set up
your threads either extending Thread or implementing Runnable.
Hand in:
Miscellaneous:
·
MAKE YOUR WORK
ROBUST!
·
Make sure that your
main demonstrates that your code works.
·
Put YOUR NAME, and
e-mail address in comments at the beginning of the program.
·
Remember: Indentation, meaningful variable names, and
meaningful comments. Weaknesses in any of these could result in points off. You MUST include comments that explain your
program in order to get full credit.