CIS 400 Assignment 2
                           Fall 1999

     In this assignment you are to write a series of Lisp 
functions which will allow you to play a simplified version of the 
game Paper-Scissors-Rock. You will also be required to implement 
several algorithms using the functional style in a procedural 
language like Pascal or C++.

     For the first part of the assignment, write Lisp 
implementations for the functions described below: 

  1. A function COMPUTER-MOVE which has a NIL argument list and           
     returns a random number from 1 to 3, inclusive. (Hint: The 
     Common Lisp function call (RANDOM 3) returns values ranging 
     from 0 to 2.)

  2. A function CONVERT that takes a number (1 to 3) as an 
     argument and returns as its value PAPER, SCISSORS, or ROCK.

  3. A function GET-MOVE which has a NIL argument list and 
     prompts the user to type P, S, or R and returns PAPER, 
     SCISSORS, or ROCK as its value. (Hint: Write a helper 
     function similar to CONVERT. Prompts may be displayed using 
     PRINT or PRINC and replies read using READ). It would be best 
     if bad input values were discarded and the user were 
     prompted for replacement values.

  4. A function TWO-MOVES which has a NIL argument list and 
     returns a list having the value of the computers move 
     followed by the value of the user move. For example,
     (TWO-MOVES) might return the throw (PAPER ROCK).

  5. Predicate functions COMPUTER-WIN-P and TIE-P which each have 
     a single list argument like the one produced by TWO-MOVES.  
     COMPUTER-WIN-P and returns T if the computer move beats the
     user move and NIL otherwise. For example, (COMPUTER-WIN-P
     '(PAPER ROCK)) returns T. TIE-P returns T any time the two 
     move match. Of course, like always PAPER covers ROCK, ROCK 
     smashes SCISSORS, and SCISSORS cut PAPER. 

  6. A function DESCRIBE-VICTORY which takes a single list 
     argument similar to that produced by TWO-MOVES and returns a 
     one of the appropriate lists: (PAPER COVERS ROCK), (ROCK 
     SMASHES SCISSORS), (SCISSORS CUT PAPER). For example, 
     (DESCRIBE-VICTORY '(PAPER ROCK)) returns (PAPER COVERS 
     ROCK).
 
  7. A function PSR which can be called repeatedly by the user to 
     simulate the game. Model your output after the examples 
     shown below:

       >(PSR)
        (ENTER MOVE: P S R)R
        (I WON PAPER COVERS ROCK)

       >(PSR)
        (ENTER MOVE: P S R)S 
        (YOU WON SCISSORS CUT PAPER) 

       >(PSR) 
        (ENTER MOVE: P S R)P 
        (TIE -- WE MATCHED) 

     For the second part of your assignment, you are to implement 
these functions from the first part in some imperative language. 
You are to write this program in a functional style, without 
excessive reliance on the assignment operation. This means that 
you may use any control structures from the language you wish, but 
you must write functions not procedures. 

     You may use any Lisp dialect you have access to (XLisp can be 
downloaded from the Internet and muLisp lives in the CW micro 
lab). You should include enough trials of each function (Lisp or 
otherwise) to demonstrate that they perform as specified. Be sure 
that I end up with a complete listing of your carefully commented 
source code (both Lisp and whatever) as well as your output. Also 
be certain that it will be easy for me to match the function calls 
with their output (some hand written notes or comments might be 
helpful). I am not requiring a memo this time. The first part of 
your assignment will be 20 points, the second will be worth 15 
(compiler listing, language use, comments).

Assigned: 10-13-99
Due date: 11-01-99