RandomMoveInGrid/howTo-AddNewClass.txt -------------------------------------- Suppose we want to add a class WoodChip. We'll ignore the details of that class, i.e., the fields, methods, etc. 0. Create the WoodChip.java file. You could edit it from scratch, or you could start with a class that is close to what you want: cp src/RandomMoveInGrid/Agent.java src/RandomMoveInGrid/WoodChip.java and edit it. Lets assume you did that. 1. Edit the new file emacs src/RandomMoveInGrid/WoodChip.java & and then 2. change the comment at the top 3. change import'ed classes as needed. 4. change the class name on this line: public class Agent implements Drawable { if needed, change what it implements, extends, etc. 5. change the class and instance variables as appropriate. change setters and getters as needed 6. change the constructors -- name must be WoodChip, and then they must initialize this new class's variables. 7. change/replace all other methods as needed I would suggest doing this step wise: a. first just take out all from the class you copied. compile as in step #8 below. b. then start adding in new methods, one or a few at a time, NOT all at once. (see note below) 8. now compile with one of bin/compile.sh ant compile debug as needed! Now you can begin to use the class in the rest of your program! Again, though, you might want to start using a simple version of the agents defined by this class, i.e., agents that do something simple or "dumb" and after that is working as expected, change this new class of agents to do more sophisticated things. ----------- Note: For other models in the Demos-3 series, you can do the same thing, Just change the names of the source directories and files as appropriate.