Next: Adding a Graphical User
Up: Introducing software design
Previous: Implementing these patterns
The source code for the observer pattern can be found here.
- Implement another observer,
TextRenderer
, to print out the
total energies. Does your simulator or minimiser code get any more complex
or difficult to read?
- Add the ability to turn the text renderer on or off. In which class
does the code go?
- How much would you have to modify your existing code to use a different
3D graphics library?
- Add the ability to customise exactly which energy values are printed out,
and whether the atoms are coloured or not, all from the command line. Comment
on the difficulty of running the program now.
- Add a feature on the visual output to display arrows that point the
direction and magnitude of the force on each atom. Comment on the size of
the arrows relative to the force that we want to see, and then implement a
method of limiting the size to something usable.
James Roper
2004-02-12