Open antonwsu opened 3 years ago
So that we don't forget. What I mean by consistency is that we must be able to create Clara's inside the Home class as follows.
void run () {
for (int i = 0; i < INSECTS_LIVING_HERE; i++) {
MyClara clara = new MyClara(this);
clara.initialise(this);
}
}
Currently it's
void act() {
for (int i = 0; i < INSECTS_LIVING_HERE; i++) {
MyClara clara = new MyClara();
clara.initialise(this);
}
}
It's important to have run() instead of act() and to pass this to the constructor. Not passing this is a neater way, so let's remove this for the 2nd edition of the book. For now, however, we need to keep it.
Actually, I can simply update the base class with comments that functionality has changed. But please change act() to run().
I've updated the code for ClaraAnt. It should be acceptable, but please change act() to run().
It's important to have consistency with the book for Chapter 10 problems. Some readers may decide to complete the exercises themselves and will be confused that they can't do it. It's not an urgent task (since they can still run the solution).