The Stub sets up the hardware in the system.

When the system starts up, the Stub checks for the flippers in the system. The system finds the locations of the flippers by flipping each flipper a set number of times. It takes the over all change in the image and averages the center of that to be the flipper.

If there is a flipper's file available it reads in the locations and skips the flipper test. It then stores the location back the file. It saves the file regardless.

A statistics object, Stats, is created to keep track of ball in play, time in play, number of hits, number of ball, and other statistical information about game play.

A StrategyQueue is created to keep track of the buffers waiting to be used by the strategy.

The logging of the information is done to the PinballLog.

Logs the locations of the flippers.

It checks the objects in the frame to see which is one is the ball.

Logs each of the objects and which one is considered to be the ball.

It then does the statistics for the ball.

  1. Logs the status of the flippers.
  2. Checks if the ball is launchable. If so, the ball is launched into play.
  3. Checks if the ball is in play.
  4. Checks if the ball is out of play.
  5. Checks if the ball is near the flippers. If so, it can now become potentially hit.
  6. Checks if the ball was near the flippers and is now in the flipper zone. If those conditions are true, then the Stub knows that the ball was hit.

The Buffer is placed in the StrategyQueue.

The Stub will notify the strategy when it's done with a Buffer.

Every 100 frames, the frame rate statistics are displayed on the screen.