Strategy gets a reference to the first Buffer and the TextArea from the window for writing statistics to it.


Strategy decides what to do with the flippers in the game.

Strategy creates a Stub, which is the way the strategy communicates with the information buffer, and the hardware of the system.

Strategy sets up some parameters for the Stub in deciding if an object is the ball.

There is a StrategyQueue created by the Stub to keep track of waiting buffers for the strategy.

Before checking what to do with the ball, the strategy gets the current location of the flippers and some other information about the game play. Likely this should not be called every time. The Stub should call this only when the information has changed.

Common commands used in the strategy are:

Stub.blipx() - Get the ball's x location

Stub.blipy() - Get the ball's ylocation

Stub.leftFlipperState(boolean) - Should the left flipper be up

Stub.rightFlipperState(boolean) - Should the right flipper be up

Stub.leftx() - Get the left flipper's x location

Stub.rightx() - Get the right flipper's x location

Stub.lefty() - Get the left flipper's ylocation

Stub.righty() - Get the right flipper's y location

Stub.logit(various options) - Have a message written to the log file.