Programming in Perl

Extra Credit Homework 7

Due Sunday May 4th 11:59:59pm EDT

This homework is completely and totally optional. There is no penalty for choosing not to do this homework. Completion of this assignment will add points to your homework total, including going above a 100% homework average.

Option A

Use Perl/Tk to create a simple unit conversion program. Your program should present to the user a field in which to enter a number of units. It should then present a list of valid units to choose from (ex: inches, centimeters, liters, gallons, miles, pounds, kiligrams, etc). Based upon the units selected, the user should then be able to select a unit to convert to (ie, if inches are selected, allow the user to convert to feet, yards, miles, centimeters, meter, kilometers). Once the user selects the two units between which the conversion happens, he pushes a button. Your program then displays (in a method of your choosing - a text field, a label, a popup box, etc) the resultant amount of units.

This project is worth a maximum of 50 points added to your homework total (ie, 8 1/3 points on your homework average, or either 5.83 or 6.67 points added to your final grade).


Option B

Write a chess program in Perl/Tk. Create a 64 square chess board, along with the appropriate 32 chess pieces. Allow the first player to move a piece either by click-and-drag, or by entering a textual code into a text field. Then allow the second player to move. Enforce official chess piece movement and capturing rules. Continue until one player's King is captured, and declare a winner. Allow the user to start a new game or just quit the program. Note: you can assume there are two human players; you do not have to create a chess-playing AI.

This project is worth a maximum of 100 points added to your homework total (ie, 16 2/3 points added to your homework average, or either 11.67 or 13.33 points added to your final grade)


For both options, the grading is almost entirely subjective. The programs will be awarded points based on how well I think they function. In order to obtain the maximum number of points for either option, the program will have to perform in close to perfection. Partial credit will be awarded based on how good an attempt was made at making a full complete program
If you choose to do this assignment, you may NOT do both options. Choose one. Only the final submission will be graded.

Please make sure your code files and are well documented, and that the UI is as intuitive as possible (providing some sort of documentation within the program would be a good idea too).


Submission Instructions

You may use either ~lallip/public/submit.pl on RCS, or the CGI submission page. Ignore the URL field. As before, if you choose to create multiple files for your program, make sure they are contained in a .zip or .tar.gz file.

VERY IMPORTANT Ideally, your program should work on any system that has Perl/Tk installed. However, just in case, make sure you document which machine, operating system, Perl version, and Tk.pm version you used to test your program. This information should be contained in a comment at the very beginning of your file (after the shebang, of course)
For machine: if you use solaris.remote.cs.rpi.edu, issue the command `hostname` to check the machine name. If you use an actual CS Lab desktop, the machine name is taped to the monitor. If you use your own computer, say so.
For operating system, print the value of $^O (that's a capital o, not a zero).
For Perl version, issue `perl -v` and report the version number.
For Tk.pm, issue the command `perl -MTk -e'print "$Tk::VERSION\n"'`

Finally - as this program is entirely extra credit, I and the TAs will NOT be available for any assistance. You must find information and solutions to your problems on your own. (Exception is made only for the general question of getting Perl/Tk installed and/or functioning)