Comp 388-005 Week 7

Lewis Tower 415, 4:15-8:15

Welcome

Final exam study guide






Variable scope in C#
    forscope.cs
    forscope.cpp

Polymorphism

World of Zuul
    Downcasting vs Upcasting

Overview of adding a StoneRoom to Zuul. Our edible will be a cookie, and we will not create a special class for them.

The general respond() logic is as follows:

if the command is "eat cookie":
    make sure the user has the cookie
    if so, remove the cookie from the inventory
    say something about new energy
    set just_eaten = true

if the command is "move stone":
    if not just_eaten, say it's too heavy
    if stone is already moved, say so
    say something like "fired up with sugar, you are able to move the stone!"
    add a JEWEL
    update the room's description (note the use of the constructor altdesc here)

Note that all the work is in class StoneRoom, except for two lines to create the room in RoomMaker.cs. We don't have to change the existing game logic.

I want the effect of eating the cookie to last only a single turn. Notice how I can handle this in StoneRoom.Respond().



Tree balancing

See trees.html#balancing

Binary tree manipulations
    AVL tree annotation

B-trees

C++ memory issues
    smart pointers