Pluggable Framework is a way to separate guns and movement into different classes, allowing for such classes to become “pluggable”. The trick to this is simple:
At the beginning of your overall robot, you first import the classes you wish to plugin.
import ry.gun.*; import ry.move.*; |
Then, you place them in the variables section and declare them.
private static WaveMover movement; private static CircularTargeting gun; public PluggableFramework() { gun = new CircularTargeting(this); movement = new WaveMover(this); |
That’s it for the setup. Now, in every method that you wish to carry over a function from, you would put
movement.onScannedRobot(e); |
, for example, if you wished to put the movement code of WaveMover into onScannedRobot. Do this for all of the methods.
You’re Done! (at least in the PluggableFramework side).
Now, in the Gun/Movement side, you’d need to do a little work. A gun or a movement can’t be extends AdvancedRobot, so instead, you put a header like this:
public class LinearTargeting { private AdvancedRobot _robot; public LinearTargeting(AdvancedRobot robot) { _robot = robot; } |
Every function that is part of AdvancedRobot should be prefixed with _robot. in order for it to work. Example:
_robot.setFire(1.9); |
After you’re done with that… you’re usually done. Note that if you call
this |
, you may have to change it to
this._robot |
Note: Any and all code provided, if used in your robot, should have credit attributed to Robert Ying unless otherwise noted
Files:
Pluggable Framework
Linear Targeting
Circular Targeting
Head On Targeting
WaveSurfing
RandomMovement

Dude, why would we give credit to you. You didn’t even write the stuff.
:D
I wrote them for PluggableFramework… And how else would you write a Circ/Linear/PT gun