Things appear to work. Implemented a get-out-early optimization; there are more to do (such as not sweeping from left to right but in widening oscillation, and thinking through rows and columns, and having a general way of turning an image into a bitmap)