[Home]History of ObjectOrientedProgramming

Robo Home | Changes | Preferences | AllPages


Revision 3 . . December 29, 2005 18:38 EST by Martin Alan Pedersen [an example of OOD that paid off handsomely]
Revision 2 . . December 29, 2005 16:19 EST by Voidious [filling in this page on OOP]
  

Difference (from prior major revision) (no other diffs)

Added: 5a6,7

One of my early design adventures in Robocode was to model the physics with OOD. I have position (x,y), heading, and velocity objects, for both static and dynamic versions (static cannot be updated), and combinations representing a vector (static heading and velocity), projectile (dynamic position and static vector), and vehicle (dynamic position, heading, and velocity). The objects have methods to allow comparison or addition with other objects. For example, I can add a vector to a dynamic position and move the position one unit forward. I can compare two positions and get either the distance or the bearing from one to the other. Other stuff as well, handled by the objects rather than calling some generic class that holds math routines. By modeling them with interfaces (and implementations) I am able to pass a vehicle to a method that wants a static position, for example, and other polymorphic stuff. -- Martin / Ugluk

Robo Home | Changes | Preferences | AllPages
Search: