Stroke recognition engine.

Partial implementation.