Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
Fall 2004 M1
Create Objects to Represent Characters and Things
The primary focus of a simulation game is the characters that inhabit the simulated world. You will begin this project by defining a class to represent various characters that will play roles in the world of SimTech. Because you also will be concerned with posessions and other inanimate factors in the game, you will also have to represent them with a different class, since they don't have the same set of behaviors as a character does. Finally, it will likely be convenient to save a game in some way other than by just saving a Squeak image. You will have to create an external representation for the objects used to define you SimTech world.
Because the name Character is already used as a class name in Squeak, we have to pick another name for the class that will represent the people of SimTech. To keep things simple, we will just can the class Person.
1. You will create an object to represent an individual by sending new to Person. You must implement the following methods to associate information with a person (assume that p := Person new. q := Person new. r := Person new.) :
- Naming: p name: 'George P. Burdell'.
- Gender: p gender:#male. q gender:#female. Gender can be retrieved by calling p gender.
- Attributes (relatively static and can have arbitrary values): p attribute: 'Major' is: 'CS'. p attribute: 'Athleticism' is: 'low'.
- Game factors (changed by activities, interactions, etc. and have numeric values): p factor: 'happiness' is: 5. q factor: 'health' is: 2.
2. You will create an object to represent a generalized "thing" by sending new to Thing. You must implement the following methods to associate information with a thing (assume that t := Thing new.) :
There will be a number of subclasses of Thing as we add more details to the game.
- Description (for printString): t description: 'College of Computing Building'.
- Attributes (like for characters): t attribute: 'comfort' is: 'ok'.
3. You are to create tha ability to export the state of your "game" by creating a textual representation of all of the Person and Thing objects defined in your game world. You will later have to read in your textual representation to initialize a game state, so think about this step as you define your textual representation.
4. Test the classes you implement using SUnit. You should have SUnit classes PersonTest and ThingTest that test Person and Thing. These should be runnable from within TestRunner and contain tests for each method.
Before class time on the due date, turn-in your well-documented code (at least two lines of comments for each non-accessor method, in-line comments at significant portions) using the turnin coweb: http://coweb.cc.gatech.edu/cs2340turnin
- 20% Good Smalltalk style:
- 10% Good reuse of existing code
- 5% Good variable names that start with lowercase letters
- 5% good comments.
- 80% Correct implementation:
- 20% Correctly use SUnit to run unit tests
- 20% Correctly implement Person class
- 20% Correctly implement Thing class
- 20% Correctly generate a display of all Person and Thing objects
Links to this Page