CS U670 Assignment #5 [Revision 2] Assigned: Tuesday, 8 April 2008 (revised 12 April) Due: Tuesday, 22 April 2008 Working in a team of three students, write a program that collaborates with similar programs written by any number of other teams to find the enchanted frog and carry him/her out of Prince Charming's castle. Your program should read messages from standard input and write messages to standard output; depending on your i/o library or programming language, you may need to flush an output buffer after each message. Your program should begin by reading exactly one message from standard input; if that message has the form of a ... element, then your program should write exactly one of the possible output elements to standard output and repeat; if the input message is anything other than a ... element, then your program should exit normally. The syntax of input and output messages is described by the Relax NG specifications shown below. Since we are working with messages, not documents, we will restrict all messages to Ascii characters and to the elements shown in the Relax NG specifications. XML comments and other XML folderol will not be permitted in messages. Your program must run on any CCIS Solaris machine without requiring the installation of software or libraries that are not already installed on those machines. If your program uses libraries that are not already available on CCIS Solaris machines, then those libraries must be part of the code you submit for this assignment. You must, of course, have permission to include those libraries as part of your submission, which may make it impossible for you to use some libraries in your program. Your program must be accompanied by a README file that identifies all of the files you are submitting for this assignment and tells the instructor how to build and to run your program. You should assume the instructor has some familiarity with programming but knows absolutely nothing about the specific programming language(s) and other software used by your program. You will submit this assignment using a Unix shell script provided by the instructor. This shell script and the instructions for using it will be similar to the shell script and instructions given for the previous assignment, but may incorporate some improvements. Late assignments may be discounted, and very late assignments are likely to be discarded. -------------------------------------------------- prince princess soldier minion peon dragon up down north east south west -------------------------------------------------- up down north east south west -------------------------------------------------- Rules. An element indicates you have escaped from Prince Charming's castle, but the frog is still inside the castle. You should respond with either a or message. A message will be acknowledged by a ... message; will cause you to reenter the castle, but you will not necessarily reenter the castle through the same exit by which you left it. A ... element describes a room and its contents. Each room's purpose, characteristics, and exits are fixed (although the characteristics and exits may be presented in any order). Each room may also hold any number of characters and items, which may vary over time. Each character is a participant in the game. Some of those characters are generated and controlled by the referee program, but some of the peons may be controlled by another team's game-playing program. Items are small enough to be grasped, but you can only grasp one item at a time. The main goal of the game is to find the frog, grasp it, and carry it out of the castle. Paper gives you a way to communicate with the peons controlled by other teams. You can read the contents of a paper item without grasping it. To change its contents, however, you must first grasp the paper. Then you can write a new message on the paper, which overwrites its previous contents. (It's magic paper.) You may drop paper immediately after writing on it, or you may carry it with you. Treasure has numerical value, but is not as valuable as the enchanted frog. If you are holding treasure, then you are more likely to be assaulted by dragons. Dropping treasure in the presence of a dragon may earn its friendship. Shields have numerical value. Higher values are more protective against assaults. Weapons have numerical value. Higher values are more deadly. Heat-seeking missiles and thermonuclear weapons should be employed only in well-ventilated areas. When you launch an assault, you assault all of the other characters in the room. Assaults can be launched at any time, but will be less effective if you are holding a frog, paper, treasure, or shield than if you are holding a weapon. Princes, princesses, and soldiers have been trained in the martial arts; it's easier to murder minions and unarmed peons than soldiers or royalty. Dragons don't like to be poked, and are especially annoyed by automatic weapons. In general, the referee program will ignore inappropriate messages. The referee program will interpret consecutive inappropriate messages as a sign of derangement, and will respond with a ... message.