Announcements about Assignment 5
Aug 5: Can I choose 2 or 3 as my maximum branching factor
for the family tree? No (and yes). This should be a
constant in your program, but your code should be general
enough to work with any branching factor. That is, you should
be able to change the constant from say, 10 to 20, and still
have the program work. The code should not be designed to
work with just one branching factor. This is only important
for implementations that use arrays, since you have to fix the
size of the array before you start.
Aug 5: Having problems completing one part of the assignment?
Then a good idea is to try another part of the assignment, and come
back to the troublesome part later. It's due soon, so budget your
time carefully.
Aug 5: Your output of FamilyTree should somehow show the
structure of the tree. This can be as simple as indenting a few
spaces for each level you go down in the tree. It doesn't have
to be fancy like the example trees on the assignment. Some
people have asked if they can change the Prnt method of the
Object class for making fancy trees. If you want to make really
fancy trees (for the bonus marks), then you are allowed to
change the Prnt routine, or make an new print routine that does
special formatting of the name. But only change this if you
need to for making fancy trees; there is no need to for simple tree
output.
Aug 5: What kind of statistics should a new piece of terrain
output? Well, you could have it count the number of times
that kind of terrain is used in the world. Or you could count
how many times an animal walks in that kind of terrain, but
that would have to be done in the Animal classes. For other
new classes, you should output some statistics related to
their new behaviour. Maybe each time it uses its special
behaviour, add to a count for using the behaviour. You can
have other stats. if you like.
Aug 1: Of course, you should add new constants
to the SimVar module for the Carnivore, so you are allowed to
modify this file when writing your Carnivore and 2 new
classes.
July 31: What counts as a different class for the two
new classes we have to write?
Anything that has a new behaviour that no other
class of objects has. You either have to override an existing
method so that it does something new, or you have to add a new
method that does something unique. E.g., making a Mouse that
can Die is not unique, because Herbivores already have that
behaviour. It is ok to make a new kind of Terrain (which isn't
very unique), if you also make a new kind of animal or other
active object that does something special in that terrain. Of
course, you don't have to make a new kind of terrain. Any 2
classes will do. These are the minimal requirements; feel free
to impress us with more creative classes.
July 31: You should not modify any of the existing code to
implement the FamilyTree class, or the Carnivore class, except
the main program. Not only is it unnecessary, but it breaks the
basic rules of software re-use.
The only time you're allowed to modify code on this
assignment is when you're implementing your two new classes.
You might have to, for instance, modify the World class so that
it displays a new kind of Terrain. Or perhaps you'll need to
add a new method to an existing class.
July 31: The only things that has Carnivore has to do are
listed in the assignment. They don't have to mate. They don't
have to make family trees.
July 31: The assignment says that the answers to questions 2 to
6 should fit on one page, implying that question 7 is somehow
special. Sorry, that is just a typo. Answers 2 to 7 should all
fit on a single page. For the more vague answers, try to be as
specific as possible in the space allowed. You just have to
convince the TAs who are marking that you understand.
July 31: How do I `get at' the name of Herbivore so that I can
print it? A: As you have noticed `name' is a private variable
defined in the Object class that is inherited by the Herbivore
class. You can't get at it directly because it is private, but
you can print the name of any herbivore using the exported Prnt
method (in the Object class). E.g., if you have a pointer h to
a herbivore, then h->Prnt(stream) will print its name to the
already open file stream.
July 29: Debugging your new programs can be difficult in this
assignment. If you turn on tracing at the beginning you might
have to wait half an hour before you get to the code you want.
What a pain! Well, to get around this, here's two common
practices:
- insert put statements in appropriate places that will tell you
how the program is progressing. You can have them print out some of
the variables so you can see how they're changing. You
should remove the put statements in the final version.
- if you put a get statement where you want to start
tracing, then the program will stop there and wait for your
input. While it's waiting, turn on tracing, and then type
some `dummy' input and hit . The program will start
up again with tracing. You should remove the get
statement in the final version.
Try a combination of the two methods. Hope this helps.
July 29: In the Family Tree code you will find the comment
initialize the three instance variables. You can
ignore this comment because it is irrelevant now. It is leftover from
an older version.
July 29: Some people are wondering how to refer to the
herbivore objects inside the family trees. You should just store
the pointers to the objects (the pointers are defined as
pointers to Animal) in the tree. You can compare pointers just
like you compare ints or strings to decide if you have found
a parent in the tree during the search. More on this in tutorial this week, if you
ask.
Last modified: Tue Aug 5 18:28:26 EDT