replace the "mkString" method in toString of "AbstractCreature" by the Utils version. This should work flawlessly while being generic!

refactor the code of creatureAround() so to use a filter function

Inheritance and refactoring

In the first lab, you were asked final questions about the code structure of the first version of the simulator, questions like:

What to do with some of the utility functions?

What to do with the fact that logic of the Environment and the visualization are kept together?

Use the refactoring support in Eclipse (right-click and get into submenus on elements you want to refactor) to get the following inheritance hierarchy for creatures:

Then do another refactoring to abstract and separate the simulation from its visualisation. You should be close to the following organization (proceed step by step and with eclipse refactoring as much as possible) :

NEW Hints:

Refactor first methods that use x,y so to use Point2D (you cannot make it automatically), check that tests continuously run OK

Create needed getters and setters

Extract interfaces by the refactoring tools of Eclipse (progressively go towards the proposed class schemas, continue to check that tests run OK)

Do not use Eclipse refactoring to move big methods such as "creatureAround()" (which moves from Environment to SmartCreature. Do not run the tests until the refactoring is done, you need to carefully refactor the tests as well

Use the following code for the Simulator thread (and note that all methods of the Simular class must be declared synchronized):