itle="style1"> cs150: Problem Set 6: Adventures in Charlottansville
cs150  Spring 2009

cs150: Computer Science
from Ada and Euclid to Quantum Computing and the World Wide Web


Instructor
Westley Weimer

Teaching Assistants
Zak Fry
Paul DiOrio
Rachel Lathbury

Email Address
cs150-staff@cs.virginia.edu

Class Meetings
Mondays and Wednesdays, 3:30-4:45pm in MEC 341
Structured Lab Hours
Wednesdays, 7:00-8:00pm and 8:00-9:00pm in OLS 001
Staffed Lab Hours
(Small Hall Lab)

Monday 5:00-6:00 (Zak)
Tuesday 3:15-4:15 (Rachel)
Thursday 5:00-6:00 (Paul)
Sunday 3:00-4:00 (on request)
Office & Lab Hours
(Small Hall Lab)

Monday 2:00-3:00 (Rachel)
Tuesday 11:00-12:00 (Wes in Olsson 219)
Tuesday 3:00-4:00 (Zak)
Wednesday 1:00-2:00 (Paul)

les
  • What to do when the last few adjudicator tests are failing but the test cases seem to output the right stuff:
  • A few people were having problems with number 3. If you use a "case" statement (like make-student and make-police-officer) it should be fine. It appears that the nested if statements provided may have had some misplaced parenthesis. If using the ifs, ensure that every nested if is the else branch of the preceding if...in other words, make sure the parenthesis close as such:
     
    (if (eq? message 'class)
       do-stuff
       (if (eq? message 'location)
           do-other-stuff
           (if (eq message 'is-dressed?)
                do-yet-other-stuff
                #f)))
    
  • Finally, on an administrative note, there have been increasing concerns that we TAs spend too much time per group (especially in office hours where there's only one of us at the time). This is probably true — as the PS's get harder, it takes longer to figure out the problems. Also, each function usually does more than one thing now so there are several parts to each solution — which takes more time. We understand this and are trying to speed up as best we can. That having been said, we ask you to understand that during office hours we'll try to solve one problem at a time and then ask you to put your name back on the list. Furthermore, we would really REALLY appreciate it if you really try to work through stuff and have specific problems before asking for help. The "I have no idea what's going on ... please help?" question is not only difficult to help with but takes a long time. If you take the time to look at all the relevant code and at least attempt some code. This way our trouble-shooting and explanation will hopefully go a lot faster. Also, you'd be surprised by the amount of knowledge you gain by looking through the other .scm files and trying to figure out what you should do and what the tool for the job is.

    Again, a reasonable strategy for any problem is as follows:

    1. Figure out what you have to do — writing pseudocode or at least formulating English statements of what has to be done
    2. Find the necessary functions or figure out what combination of functions will do the job
    3. Finally, figure out the specific syntax of the procedures you want to use
    Ideally, we'd be helping with only step number 3. Figuring out steps 1 and 2 is where the value of doing the assignments lies.
  • Hints: More detailed hints are available for this problem set.

    Collaboration Policy - Read Carefully

    If you wish to be assigned a partner for this assignment, send me an email by 11:59 pm, Thursday, 12 March. Otherwise, you may work on this assignment alone or with one partner of your choice.

    Regardless of whether or not you have a partner for the problem set, for the final question, you may combine efforts with as many students as you wish.

    Purpose

    Read Chapters 10, 11 and 16 (yes, skip ahead) of the course book.
    Download: Download ps6.zip to your machine and unzip it into your home directory J:\cs150\ps6. This file contains:
    ps6.scm — A template for your answers. You should do the problem set by editing this file.
    objects.scm — code that defines objects. Defines classes for people, places and things.
    adventure.scm — code describing the imaginary world of the game and playing
    listprocs.scm — the list procedures we have defined so far in class

    Background

    In the 1961, Digital Equipment Corporation (later part of Compaq, which is now part of Hewlett-Packard) donated a PDP-1 mini-computer to MIT, hoping they would use it to solve important scientific problems. Instead, Steve Russell invented the first computer game: Spacewar!. Ten years later, Will Crowther produced the first interactive fiction game, Colossal Cave Adventure (or Adventure for short). Inspired by Adventure, a group of MIT students created Zork and released a version for the Apple II. The game became wildly popular, and was the cause of many students failing out of school.

    For this problem set, you will create your own adventure game. Our game takes place in a far-off fictional land known as The University in Charlottansville, East Virginia. Set on bucolic grounds of rolling hills, grassy fields, and red-brick buildings, the characters in our adventure game will take us to imaginary places like the Cabal Hall, Cdrs Hill, the Recursa, and Oldbrushe Hall. All of the places and characters in our game are purely fictional (although most are not purely functional, since they use mutation). Any similarity to real persons or places is purely coincidental.

    Programming an adventure game involves modeling objects in a fictional world. Hence, you will build your adventure game using techniques known as object-oriented programming.

    Q: So some of the locations in the game are based on real places?
    A: Except for a few. As far as I know, there is no eldricth altar at which students are sacrificed to nameless gods. But then, I was never a professor, so I can't be sure.
    Dave Lebling, on The Lurking Horror adventure game

    Objects

    For our game, we need to represent three basic kinds of things: people, places and things. Every object we make will be a person, a place or a thing, so we will need classes that implement each kind of object.

    We have provided a constructor procedure called make-class for creating an object of each class. All objects in our fictional world have names (rumors about a "Nameless Field" are as yet unsubstantiated), so each of our constructor procedures will take a name parameter. We use quoted symbols (see Chapter 11) for names. The three constructors are:

    To put a new thing or person in our fictional world, we must install it in a place. The procedure install-object takes two parameter, an object and a place, and installs the object in the place.

    Once an object is installed, we interact with it using ask to send a message to an object that invokes a method:

    All objects in the system are manipulated using message-accepting procedures. Procedures defining our objects are defined in objects.scm.

    Different objects handle different messages. Here is a partial list of messages you can use. The ask procedure is used to implement each of these. Note that some of the messages have parameters.

    In adventure.scm we define some places in our imaginary world. The procedure set-up-charlottansville installs those places and sets up connections between them. For example, the definitions
    (define Cabal-Hall (make-place 'Cabal-Hall))
    (define Bart-Statue (make-place 'Bart-Statue))      
    
    make two places, Cabal-Hall and Bart-Statue. In set-up-charlottansville, we use can-go-both-ways to connect Cabal-Hall and Bart-Statue:
        (can-go-both-ways Bart-Statue 'south 'north Cabal-Hall)
    
    We can experiment with our world by evaluating (set-up-charlottansville) and then asking objects in our world to do things. (The provided file ps6.scm does this when you load it.) For example:

    > (set-up-charlottansville)

    welcome-to-charlottansville

    > (ask Cabal-Hall 'exits)

    (down north)

    > (ask Cabal-Hall 'name)

    cabal-hall

    > (ask Cabal-Hall 'neighbor-towards 'down)

    #<procedure>

    > (ask (ask Cabal-Hall 'neighbor-towards 'down) 'name)

    steam-tunnel

    Question 1: Why does (ask Cabal-Hall 'neighbor-towards 'down) evaluate to a procedure?

    Our world needs some people in it, so let's create one, and install him in our world:

    > (define JT (make-person 'Jeffus-Thomerson))

    > (install-object JT Cabal-Hall)

    Installing jeffus-thomerson at cabal-hall

    installed

    We can also make things and add them to our world. For example, let's create a sandwich and place it in Cabal-Hall (where JT is now).
    Ah, we are all heroes. You and Boo and I, and the sandwich! Hamsters and rangers everywhere, rejoice!
    Minsc, Baldur's Gate II
    Mr. Thomerson looks around, sees the sandwich and takes it:

    > (define sandwich (make-thing 'sandwich))

    > (install-object sandwich Cabal-Hall)

    Installing sandwich at cabal-hall

    installed

    > (ask JT 'look)

    At cabal-hall: jeffus-thomerson says -- I see sandwich
    At cabal-hall: jeffus-thomerson says -- I can go down north

    (sandwich)

    > (ask JT 'take sandwich)

    At cabal-hall : jeffus-thomerson says -- I take sandwich

    #t

    Try playing the adventure game. Load ps6.scm in DrScheme. Then, in the interactions window, start making people and moving them around. Get a feel for how objects work before moving on.

    Defining Objects

    All the people, places and things in our adventure are objects. The procedure make-sim-object creates a new object. Here is make-sim-object without using any syntactic sugar:
    (define make-sim-object 
      (lambda (name)
        (lambda (message)
          (if (eq? message 'object?)
    	  (lambda (self) #t)
    	  (if (eq? message 'class)
    	      (lambda (self) 'object)
    	      (if (eq? message 'name)
    		  (lambda (self) name)
    		  (if (eq? message 'say)
    		      (lambda (self list-of-stuff)
    			(if (not (null? list-of-stuff))
    			    (display-message list-of-stuff))
    			(void))
    		      (if (eq? message 'install)
    			  (lambda (self . args) 'installed)
    			  #f))))))))
    
    The name make-sim-object refers to a procedure that takes one parameter, name. It evaluates to a procedure that takes one parameter, message.

    All those (if (eq? ...)) expressions in make-sim-object get pretty hard to read, so Scheme provides the case syntactic sugar to write this more conveniently (see the DrScheme help for the details on case, but you can probably figure out what you need to know from this example). Here is the sugary version of make-sim-object — it means exactly the same thing as the previous definition:

    (define (make-sim-object-sugared name)
      (lambda (message)
        (case message
          ((object?) (lambda (self) #t))
          ((class) (lambda (self) 'object))
          ((name) (lambda (self) name))
          ((say)
            (lambda (self list-of-stuff)
              (if (not (null? list-of-stuff))
                  (display-message list-of-stuff))
              (void)))
          ((install) (lambda (self . args) 'installed))
          (else #f)))) ;; no method defined for message
    

    Question 2: For each of the Scheme expressions below, write down your prediction what it will evaluate to. Then, try evaluating them in your interactions window. Write an explanation that explains clearly why they evaluate the way they do. In particular, if an expression evaluates to a procedure, you should explain what procedure it is.

    a. (make-sim-object 'book)
    b. ((make-sim-object 'book) 'name)
    c. ((make-sim-object 'book) 'fly)
    d. (((make-sim-object 'book) 'name) (make-sim-object 'donkey))
    e. (((make-sim-object 'book) 'say) (make-sim-object 'donkey) (list 'hello))
            Is the book talking or the donkey?
    f. (eq? (make-sim-object 'book) (make-sim-object 'book))

    (Your predictions do not have to be correct for full credit, but you must make them.)

    Interacting with objects by calling them is awkward, so we want to define an ask procedure that sends a message to an object. You should be able to figure out these definitions yourself:

    (define (get-method object message)
      (object message))
    
    ;;; Send a message to an object (with zero or more arguments)
    
    (define (ask object message . args)
      (apply (get-method object message) object args))
    
    (Note: the ask procedure in object.scm is a bit different to produce better error messages.)

    Question 3: The say method of make-sim-object takes a list as its second parameter and says everything in that list. Instead of saying a whole list, we might want a method that says just one thing. Copy the definition of make-sim-object over to a new definition called make-utter-sim-object. Define an utter method of make-utter-sim-object that behaves like this:
    > (define dog (make-utter-sim-object 'spot))
    > (ask dog 'utter 'wuff)

    wuff

    You can use (display sym) to output one symbol. The output in this example would be produced by (display 'wuff).

    Inheritance

    Generic people are okay, but for an interesting game we need to have people who can do special things.

    Our basic object (procedures produced by applying make-sim-object) provides a say method:

    > (define bill (make-sim-object 'bill))

    > (ask bill 'say '(to apply or to eval, that is the question))

    (to apply or to eval, that is the question)

    What if we have lots of different kinds of speakers and we want to make them speak different ways. For example, a lecturer is a kind of speaker, except that she can lecture as well as say. When lecturing, the lecturer follows every comment with “you should be taking notes”.

    We can make a lecturer a special kind of object:
    (define (make-lecturer name)
      (make-sub-object
       (make-sim-object name)
       (lambda (message)
         (if (eq? message 'lecture)
             (lambda (self stuff)
               (ask self 'say stuff)
               (ask self 'say (list "you should be taking notes")))
    	 #f))))
    
    See Chapter 11 for an explanation of the make-sub-object procedure. When a message is sent to an object created by make-lecturer, the implementation procedure checks if the message is 'lecture. If it is, it evaluates to the procedure that lectures. If it is not, it evaluates to #f, and the superclass method is found.

    Question 4: A professor is even more arrogant than a lecturer. Define a procedure (make-professor name) that produces a professor object. It should inherit from make-lecturer, so it will be able to respond to the lecture message. It should also have a method profess that is like lecturing, but precedes every statement with "It is intuitively obvious that".

    Your professor should work like this:

    > (define ww (make-professor 'Weim-Wesser))

    > (ask ww 'profess (list "(lambda (n) ((lambda (f) (f f n)) (lambda (f k) (if (= k 1) 1 (* k (f f (- k 1))))))) is a familiar function"))

    It is intuitively obvious that
    (lambda (n) ((lambda (f) (f f n)) (lambda (f k) (if (= k 1) 1 (* k (f f (- k 1))))))) is a familiar function
    you should be taking notes

    > (ask ww 'lecture (list "smalltalk is cool"))

    smalltalk is cool
    you should be taking notes

    > (ask ww 'name)

    weim-wesser

    Note that the lecture method is inherited from lecturer and the name method is inherited from lecturer, which inherits it from object. Your make-professor procedure should fit on 8 or fewer reasonably short lines.

    State

    More interesting objects in our game will need to use state to keep track of things that might change during an execution. Look at the make-person procedure defined in objects.scm. Its pretty long because a person has many methods. Here we show some of the code, but leave out some methods:
    (define (make-person name)
      (make-sub-object (make-mobile-object name))
      (let ;; Instance variables
           ((possessions '())  ;;; What the person is carrying (a list of Objects that are things
    	(restlessness 0))  ;;; How likely the person is to move randomly
        (lambda (message)
          (case message
            ((person?) (lambda (self) #t))
            ((install) (lambda (self where)
    		     (ask super 'install where)))
            ((get-possessions) (lambda (self) possessions))
            ... Other methods not shown
            (else #f))))))
    

    A person has an instance variable possessions that is a list of objects the person is carrying (we'll get to the restlessness instance variable later). The method get-possessions can be used to see what a person is holding. Other methods use (set! possessions ...) to change the possessions a person is holding.

    Question 5: A student is a special kind of person (this doesn't necessarily mean all students are special or kind). Define a procedure make-student that creates a student object. It should inherit from person. Students should belong to the class 'student. Students should respond to the student? message with #t.

    Some of the students in Charlottansville have a strange habit of getting undressed and running around the Green, so students have an instance variable dressed that indicates whether or not the student is clothed. Initially, all students are dressed, so the dressed variable is initialized to #t. Your student class should implement three methods:

    Your student should work like this:

    > (define alyssa (make-student 'alyssa-p-hacker))

    > (install-object alyssa Green)

    Installing alyssa-p-hacker at green

    added

    > (ask alyssa 'is-dressed?)

    #t

    > (ask alyssa 'name)

    alyssa-p-hacker

    > (ask alyssa 'get-undressed!)

    At green: alyssa-p-hacker says -- Brr! It's cold!

    > (ask alyssa 'is-dressed?)

    #f

    > (ask alyssa 'get-dressed!)

    At green: alyssa-p-hacker says -- I feel much better now.

    > (ask alyssa 'is-dressed?)

    #t

    Automating Objects

    This kind of world doesn't make for a very challenging or interesting game. All the people and things only do what the player tells them to. For a more interesting game, we need to have people and things that act autonomously.

    We do this by creating a list of all the characters to be moved by the computer and by simulating the passage of time with an world-clock object. The make-world-clock procedure (defined in objects.scm) creates a world-clock object. It has two instance variables: global-time, for keeping track of the time, and clock-list for keeping track of the objects that should be sent clock-tick messages when the clock advances.

    The methods add and remove that have object parameters and add or remove objects from the clock-list. When the clock receives a clock-tick message it means time has passed. It sends a clock-tick message to each object in its clock-list. This doesn't necessarily do something every time, but for some objects it will lead to an action.

    In adventure.scm, we create a clock and add all objects installed using install-object to the clock:

    (define clock (make-world-clock))
    
    (define (install-object object place)
      (ask object 'install place)
      (ask clock 'add object))
    
    We can advance the clock by doing (ask clock 'tick).

    People hang about idly until they get bored enough to do something. To account for this, we give people a restlessness instance variable that indicates how likely they are to get bored enough to move randomly. If restlessness is not #f, a person will move in a random direction with restlessness probability with each clock tick. For example, if restlessness is 1.0, the person will move randomly every clock tick. If restlessness is 0.5, the person will move half the time (but not necessarily every other tick, since the decision whether to move or not is random). If restlessness is 0.0, the person will not move randomly. A person object has a method make-restless that take a parameter and sets the restlessness instance variable to that value.

    The University administration does not condone streaking, and has decided to strategically place police officers on the Green to apprehend streakers.

    Question 6: Define a procedure make-police-officer that inherits from person. A police officer behaves differently from a person since a police office can arrest other people. It should have the following behavior: Hint: You may find the other-people-at-place procedure (defined in objects.scm) useful.

    Try playing the game to see that your police-officer works correctly. We have provided a procedure
       (play-interactively-as character)
    that provides a better interface to playing the game. The play-game procedure (defined in ps6.scm) installs two students and one restless police officier in our world, and starts playing interactively as one of the students.

    Here's what a typical game might look like:

    > (play-game)

    At not-yet-installed: alyssa-p-hacker says -- Installing alyssa-p-hacker at green
    At not-yet-installed: ben-bitdiddle says -- Installing ben-bitdiddle at cdrs-hill
    At not-yet-installed: officer-krumpke says -- Installing officer-krumpke at bart-statue
    what now? > name
    < Result: alyssa-p-hacker>
    [Clock] Tick 1
    At bart-statue: officer-krumpke says -- No one to arrest. Must find donuts.
    officer-krumpke moves from bart-statue to steam-tunnel
    officer-krumpke is no longer at bart-statue
    what now? > get-undressed!
    At green: alyssa-p-hacker says -- brrrrr...its cold!
    [Clock] Tick 2
    At steam-tunnel: officer-krumpke says -- No one to arrest. Must find donuts.
    ben-bitdiddle moves from cdrs-hill to cricket-street
    what now? > look
    At green: alyssa-p-hacker says -- I see nothing
    At green: alyssa-p-hacker says -- I can go down west north south
    < Result: ()>
    [Clock] Tick 3
    At steam-tunnel: officer-krumpke says -- No one to arrest. Must find donuts.
    what now? > go north
    alyssa-p-hacker moves from green to recursa
    < Result: #t>
    [Clock] Tick 4
    At steam-tunnel: officer-krumpke says -- No one to arrest. Must find donuts.
    officer-krumpke moves from steam-tunnel to bart-statue
    ben-bitdiddle moves from cricket-street to cdrs-hill
    what now? > go south
    alyssa-p-hacker moves from recursa to green
    < Result: #t>
    [Clock] Tick 5
    At bart-statue: officer-krumpke says -- No one to arrest. Must find donuts.
    what now? > go south
    alyssa-p-hacker moves from green to bart-statue
    At bart-statue: alyssa-p-hacker says -- Hi officer-krumpke
    < Result: #t>
    [Clock] Tick 6
    At bart-statue: officer-krumpke says -- alyssa-p-hacker, you are under arrest!
    alyssa-p-hacker moves from bart-statue to jail
    At bart-statue: officer-krumpke says -- You have the right to remain silent, call methods and mutate instance variables.
    what now? > look
    At jail: alyssa-p-hacker says -- I see nothing
    At jail: alyssa-p-hacker says -- I can go
    < Result: ()>
    [Clock] Tick 7
    At bart-statue: officer-krumpke says -- No one to arrest. Must find donuts.
    officer-krumpke moves from bart-statue to green
    what now? > quit
    Better luck next time. Play again soon!

    Decidability

    Consider the streakability problem defined below:
    Input: An initial state consisting of a set places in the Charlottansville world, a student object (as described in Question 5) and a police officer object (whose clock-tick method may contain any code).

    Output: If there is any sequence of actions the student object can take to streak from the Recursa to the Bart Statue without getting arrested at any time during the game, output true. Otherwise, output false.

    You should assume the results of random are completely determined (that is, you can always predict what an application of random evaluates to).

    Question 7: Is the streakability problem decidable or undecidable? If you claim it is decidable, you should argue convincingly that you could define a procedure that solves it for all possible inputs. If you claim it is undecidable, you should argue convincingly that it is undecidable by showing how a solution to the streakability problem could be used to solve another problem that is already known to be undecidable.

    Extensions

    With a full command of message-accepting procedures, object-oriented programming, and inheritance, you are now ready to start making an addictive game. Keep in mind that, historically, computer games have been a colossal waste of time for humankind. As simple as this game is, it's easy to get lost (especially in the steam tunnels). Spend your time on the problems, not the game.

    Question 8: Design a non-trivial extension to this simulated world. Use your imagination!

    You can do what you want (so long as it is in good taste, of course). (As you may have noticed, the course staff has a fairly liberal notion of "good taste", but if you aren't sure, it's best to ask.)

    A good extension will use inheritance to create new types of objects in your game. For example, you may want to create a new types of people, places and things that have new behaviors. For full credit on this question, you should demonstrate at least five of the following challenges:

    1. A subclass overriding its parent's response to a message (i.e., not invoking the parent behavior and doing something else instead).
    2. A subclass extending its parent's response to a message (i.e., invoking the parent behavior but also doing something else).
    3. An interaction with the clock-tick.
    4. Behavior that depends on the state of the world (e.g., different responses based on the current location, the number of exits, the name of the current location, etc.).
    5. An object that creates other objects (careful!).
    6. A non-trivial use of the person class inventory system.
    7. Pursuit or evasion (e.g., adding something like an expert police officer that, rather than moving randomly, moves to an adjacent location if it contains a streaker; adding a squirrel that moves away from persons — or not!).

    Your answer to this question should include:

    1. A short explanation of your extensions that describes the objects you added.
    2. An inheritance diagram showing your new classes and the classes they inherit from.
    3. Code for all new procedures you write, or old procedures that you modify. If you modify an existing method, you should print out the entire method but highlight the changed code (e.g., with a physical highlighter, or underlining, or somesuch).
    4. A transcript that shows your game in action.
    5. Explicit indication of where you are addressing the challenges. For example, put a big 1 in a circle (or in a comment, or whatnot) in the writeup where you are addressing challenge 1.

    Now invite a friend over and teach them how to play. But, remember that this is a fictional world. Don't try anything from the game at home (or on the green). If you do get a chance to visit Charlottansville, make sure to see Monty's Viola, the favorite instrument of the founder of the University and author of the influential 1976 treatise, The Ultimate Declarative, which led many Schemers to revolt.

    Question 9: Define a variable staff-comments that is a string containing your thoughts on the course staff (Wes Weimer, Zak Fry, Paul DiOrio, and Rachel Lathbury). Please also include your thoughts on Kinga Doboyli, who gave the lecture on Object-Oriented Programming while Wes Weimer was away. Your string may contain line breaks if you like, or it can be one long line. Example:

    (define staff-comments "Weimer wouldn't know a cunning plan if it painted itself purple and danced on top of a mandolin singing 'cunning plans are here again'. The TAs, on the other hand, are pondering exactly what I'm pondering. Finally, Kinga pulled us out of those polar bear cages and put us to work in a chain gang.")

    More seriously, we would appreciate both positive and negative comments about your experience so far. Bonus points if you refer to specific people by name. We will not think less of you (or grade you more harshly later on) for negative comments. Actually, we prefer negative comments and constructive criticism: they tell us how to improve. When everyone has turned in the problem set, we look at all of the comments at the same time after stripping away your names.

    If you are working with a partner, make a longer comment that addresses all of your concerns.

    In any event, you will receive full credit for any comment longer than 20 characters.

    Question 10: Define a variable fireside-comments that is a string containing your thoughts on the following situation. The Computer Science Diversity Committee, in conjunction with the local Association for Computing Machinery (ACM) chapter and the local ACM-W chapter, will be hosting a series of Fireside Chats with faculty members. Each chat will feature free snacks and a different faculty member talking about non-technical topics. For example, one CS professor has written a romance novel, one does a substantial amount of woodworking, and the secret vice of another is Reality TV. There would be a list of general questions for the professor to address (and that list could be added to anonymously on-line), so that you would not be responsible for sitting around uncomfortably during "dead air". But if you were feeling adventurous, you could ask the professors anything. The goal of these Fireside Chats will be to foster a sense of community among CS undergraduate.

    Please indicate what times might work for you, and the circumstances under which you would be interested in attending such a function. Example:

    (define fireside-comments "Weekdays at 5pm -- perhaps something in the middle of the week. I would be more interested in attending a fireside chat if we could chat about fun things to do in town, or undergraduate research, or why people go into computer science, or why Olsson is so dismal. Or if there were vegetarian snacks. Or if the schedule were posted in advance on a big website. Or if I knew that I could bring my non-CS friends to pal around.")

    In any event, you will receive full credit for any comment longer than 60 characters.

    Automatic Adjudication: Submit a single Scheme Definition file that addresses Questions 3 - 6 and 9 - 10 until you are satisfied with your test results. Your scheme file should be a modification of the ps6.scm file. Each partner must submit the file separately.

    Credits: This problem set was developed by Portman Wills and David Evans for CS200 Spring 2002 and slightly revised for CS200 Spring 2003 and CS150 Fall 2005 by David Evans, and then revised again for Spring 2009 by Westley Weimer. Portman is solely responsible for all the streaking references, however. It is based on a problem set first used in MIT 6.001 Fall 1989, and subsequently in many other years including 1997, on which we based some of our code. The MIT version of the adventure game involved Deans smashing beer and party-troll eating Deans. A course at UC Berkeley also had an adventure game problem set. Their acknowledgment was, " This assignment is loosely based on an MIT homework assignment in their version of this course. But since this is Berkeley we've changed it to be politically correct; instead of killing each other, the characters go around eating gourmet food all the time. N.B.: Unless you are a diehard yuppie you may feel that eating gourmet food does not express appropriate sensitivity to the plight of the homeless. But it's a start." We like our Deans much more than they do at MIT, and UVA students don't eat much gourmet food. We thought about making our adventure game about eating Berkeley students, but were worried that might improve their student-faculty ratio and ruin our chances of ever surpassing them in the US News rankings.
    [an error occurred while processing this directive] cs150: Problem Set 6: Adventures in Charlottansville
    cs150  Spring 2009

    cs150: Computer Science
    from Ada and Euclid to Quantum Computing and the World Wide Web


    Instructor
    Westley Weimer

    Teaching Assistants
    Zak Fry
    Paul DiOrio
    Rachel Lathbury

    Email Address
    cs150-staff@cs.virginia.edu

    Class Meetings
    Mondays and Wednesdays, 3:30-4:45pm in MEC 341
    Structured Lab Hours
    Wednesdays, 7:00-8:00pm and 8:00-9:00pm in OLS 001
    Staffed Lab Hours
    (Small Hall Lab)

    Monday 5:00-6:00 (Zak)
    Tuesday 3:15-4:15 (Rachel)
    Thursday 5:00-6:00 (Paul)
    Sunday 3:00-4:00 (on request)
    Office & Lab Hours
    (Small Hall Lab)

    Monday 2:00-3:00 (Rachel)
    Tuesday 11:00-12:00 (Wes in Olsson 219)
    Tuesday 3:00-4:00 (Zak)
    Wednesday 1:00-2:00 (Paul)

    You may consult any outside resources, including books, papers, web sites and people, you wish except for materials from previous CS150 courses. You may consult an outside person (e.g., another friend who is a CS major but is not in this class, or a CS prof, etc.) who is not a member of the course staff, but that person cannot type anything in for you and all work must remain your own. That is, you can ask general questions such as "can you explain recursion to me?" or "how do lists work in Scheme?", but outside sources should never tell you what to type. If you use resources other than the class materials, lectures and course staff, define a sources list to indicate what you used and what you learned — as in this example:

    (define sources (list "seymour cray, my roommate, explained parallelism"
    "I found the shortest-path algorithm on Wikipedia"
    "I asked Professor Robins about divide and conquer"))

    You are strongly encouraged to take advantage of the Structured Lab Hours, Staffed Lab Hours and Office & Lab Hours for this course.