Please see here.
An understanding of
This project builds on your design work from the previous project, but your coding will be from scratch.
Your first job is to create an interface for locations. Locations are the basic units of the terrain where the game is played. They are responsible for having zero or more neighbors; this relationship allows an actor to move from this location to a neighbor (in this one direction only; there might or might not be a relationship for the opposite direction, but this is the neighbor's responsibility).
Start by creating an enumerated type to represent the directions for the six possible neighbors in three dimensions: the four cardinal directions as well as up and down.
Now create a location interface ILocation that maps zero or more directions to actual neighboring locations. There should be a mapping only when the corresponding neighbor is present. The interface should specify these capabilities:
Finally, create a class Location that implements this interface. Reuse suitable building blocks from the .NET framework. This implementation should be able to
Your next job is to create an interface IActor for actors that move around the terrain. For now, the actors have limited capabilities. They are able to explore the terrain, giving a starting location.
Now create an abstract class Actor that keeps track of its name and current location.
Finally, create a class Player that inherits from Actor that is able to explore the terrain in different ways. For now, players only operate on autopilot as described below. (At a later stage of this project, we will also allow users to control players with input devices such as the keyboard.)
Now your job is to create an interface ICarriable for carriable items. For now, this item does not need any specific capabilities.
Create an Marker class that implements ICarriable. Markers come in different colors (use System.Drawing.Color).
For good reasons discussed in class, additional capabilities of locations are provided not using inheritance but in the form of wrapper or plugin classes that enhance individual location instances as needed. For now, we will support two capabilities or characteristics:
Your job is to design these enhancements in such a way that they allow actors to explore the terrain. This means that locations need to provide the actor with a way to find out what enhancements are present at a given location.
You should not use either of the following approaches to enhance the capabilities of a location:
A player is able to explore any terrain by dropping green markers in the locations they visit as they move through the terrain. When they get to a dead end, they back out and replace the green marker with a red one. The exploration ends when the player encounters an exit.
Build a terrain you would not want to be trapped in:
Then have your player explore the terrain on autopilot as described above until she/he finds an exit. Note that the locations will automatically report the movement of the player.
Create a unique, globally accessible trip recorder instance that gets notified by any location whenever the player enters or leaves that location. Whenever the trip recorder receives notification, it prints output such as
Player entered Banquet Hall.
Player left Banquet Hall.
Player entered Dungeon.
Player left Dungeon.
Define a terrain printer that starts with a given location and prints the remainder of terrain reachable from this location as a tree.
Great Entrance Hall: green marker
North -> Banquet Hall: red marker
Down -> Dungeon: red marker
South -> Walled Garden: green marker
Up -> Castle Hill: exit, green marker
Hint: the terrain printer might want to use its own, invisible markers so as not to get stuck in a circle.
In about 600-900 words (two to three pages), succinctly describe how you used each of the following design principles and patterns in your implementation and discuss to what extent the pattern simplified or complicated matters.
In particular, discuss whether you used wrappers or plugins for providing enhanced capabilities to locations.
Give your player the option of exploring the entire terrain in addition to finding the first exit. Implement this choice using suitable design patterns to be discussed in class and in the discussion group.
Other extra credit ideas are welcome pending instructor approval.
Required part, total 20:
Please submit your code and written portion following the usual online submission procedure.
Teaching > Comp 313/413: Intermediate Object-Oriented Development > Fall 2011 > Projects >