Enable javascript to see screen shots.

prev next

Text Adventure Game

Project Members:
Programmer: Jason Eaton

Languages: C++
Libraries: STL

Date Added: 12/9/2006
File Size: 38k
Download: textadv.zip

This was the final assignment for my Object Oriented Programming class. We had quite a bit of freedom on what we implemented in this program. We were given a list of things we should implement from our previous project. I decided to implement spells that had different effects for each object it was used on. We were suppoed to implement this part with a double dispatch, but I thought I had a resonable solution because we weren't told directly that we were supposed to use it for that part of the project. I ended up having a single function that mapped a string to each effect type that spells could administer. This was ugly, but almost as ugly as using the double dispatch, because it really hasn't been integrated into C++ yet, there would still have been alot of editing of older classes to get it done right. However the double dispatch shows lots of promise, because it seperates operations from the objects, which makes sense because without both objects, some operations really aren't defined. Take for example testing if a circle and square intersect. Really doesn't belong with the circle or square, it shouldn't be with both because of duplication. If you program only has a square or a circle, the operation really doesn't exist until you add the other.