# # # ##### ##### ## # # # # # # # # # # # # # # # # # # # # # ####### ##### ##### ###### # # # # # # # # # # # # # # # # # # # ###### # # # # # # # # ###### ##### #### # # # # ## # ## # # # # # ###### # # # # # # # # ##### # # #### # # # # # # # # # # # ##### # # # # # # ## # ## # # # # # # # #### # # # # ###### # # #### Programming Contest #1 So, you fancy yourself quite the ====================== hacker, eh? But, class assignments leave you feeling unmotivated. There's no real room to shine. Who cares if your grader thinks you're a hot coder? You want to show off for your peers. Well, here's your chance. If you win this competition, everyone will know who's the da dude. Simple Description Your program will receive a simple array on standard input. This array will be composed of capital letters. Your program will output a list of moves to standard output that navigates through the array from the upper-left corner to the lower-right corner. There will be penalties for crossing a cell more than twice and penalties for each move that is in reverse-alphabetic order. The program which completes the course with the highest number of points wins. Detailed Description 10 5 An example of the input is shown at the left. ABCDEFGHIJ KLMNOPQRST The input will begin with two numbers. These UVWXYZTHIS are, respectively, the columns and rows in the ISNOTATEST array. The rest of the input will be capital ITISASQUID letters. The only whitespace in the input array will be a single newline character (0x0A) at the end of each row of the array. The output of your program should be a sequence composed of N, S, E, and W. These indicate the path your program has chosen through the array. Any characters other than N, S, E, or W in your program's output will be ignored. The path begins in the northwest cell of the array. The specified move list is looped continuously until the path reaches the southeast cell. Your base score is zero. When you enter a cell of the array which you have been to k-times before, you receive ( 2 - 2^k ) points. For example, the first time you enter a cell, you receive 1 point. The second time you enter that cell, you receive 0 points. The third time you enter that cell, you receive -2 points. The fourth time you enter that cell, you receive -6 points. You get the idea, right? The only other detail here is that as soon as things start, you get that first 1 point for arriving in the initial cell. You lose 5 points each time you move backward through the alphabet. For example, moving from W to P deducts 5 points from your score. Moving from P to W, however, incurs no penalty. Any moves that would take you outside of the array are treated as if you just entered that cell again. For example, if you are at the starting position and move north, you will receive 0 points for entering a cell you have already entered before. If you then move north again, you will receive -2 points for entering a cell you have already entered twice before. If the path you specified does not end you in the southeast corner, the path will be run in continuous loop until you reach the southeast corner. Paths which make no progress toward the southeast will be disqualified, so don't waste our time. There is a 1 point penalty per move listed in your output. So, a good move list is one that is as short as possible, which doesn't cross the same squares too often, and which doesn't make many moves against the alphabet. 10 5 So, for the array given at the left, the path ABCDEFGHIJ EEEE EEEE SE SSS would give a score of five. KLMNOPQRST It never repeats any square, so it has 1 point UVWXYZTHIS for each square of the path for 14 points. It ISNOTATEST receives a 5 point deduction for moving from T ITISASQUID to S and another 5 point deduction for moving from T to D. This brings it to 4 points. And, it receives a 13 point deduction because there are 13 moves in the path. The final score then is -9 points. Another possible path is ES. This path would go through the array through these cells: ABLMWXOTASSQQUUIID. For this path, it has 14 1-point moves, 4 0-point moves, and 5 5-point deductions (XO, TA, SQ, UI, and ID), and a 2-point deduction for the 2 moves in the path. The final score then is -13 points. Submission Details All submissions must be received by 9:00am Monday 2000-02-14. All programs will be run on fury.csh.rit.edu by me. Any program that runs for more than 8 minutes will be summarily disqualified. Your program's output will be truncated at 2MB. I don't care what programming language you use. I just need to compile/run it on fury.csh.rit.edu. Your submission should be a tar-file. In the tar-file, there should be a README file listing your name, e-mail address, and text about any special hacks you'd like the judges to consider in your code. Also in the tar-file, there should be the source needed to compile your code and a gmake-compatible Makefile (if needed). Your program should be called ``pc1''. To make your program, I will type ``gmake''. To run your program, I will type ``pc1''. I will not set any special environment variables or pass any special flags to gmake or your program. This is fury: % uname -a SunOS fury 5.7 Generic_106541-05 sun4u sparc SUNW,Ultra- Enterprise I have in my path on fury (/usr/bin:/bin:/usr/local/bin): gmake 3.76.1 gcc egcs-2.91.66 19990314 (egcs-1.1.2 release) g++ egcs-2.91.66 19990314 (egcs-1.1.2 release) perl 5.005_03 awk nawk python You can either e-mail me your submission or e-mail the pathname (on the csh systems) to your submission. Prizes Prizes will be awarded in the following categories: Highest Score Slickest Code Most Maintainable Code There will also be a prize for ``highest score by a beginner''. So, if you're not a programmer, include some text in your README to tell us why this program was a really big step for you and we'll consider it. Note: Your code cannot win any of the prizes if it gets disqualified during any of its runs. ################################################### ###### more clarifications here: ###### http://www.csh.rit.edu/~pat/hack/pc/pc1/pc1a.txt ###################################################