srecord noeq RecursiveImageSplitter( IProbabilisticScheduler scheduler, URecognizer recognizer) { replace Cell with URecognizer.Cell. Node root; int minPixelSize = 64; // don't dive below this (for the splitting) // actual class for leaves, base class for split nodes class Node > Pair { // funky type Cell cell; int color; // known error (distance to image). will go up as image is // scanned in more detail. double error; *() {} *(Cell *cell) { color = cell.intColor(); } // availability - how important are we? (our percentage of total area) double availability() { ret recognizer.relativeArea(position); } double splitPossibility() { ret zeroOrOne(diameter(position) < minPixelSize); } Rect position() { ret cell.rectInImage(); } void scheduleSplits { var p = availability() * splitProbability(); scheduler.at(p, r splitHorizontally); scheduler.at(p, r splitVertically); } void splitHorizontally { } void splitVertically { /* TODO */ } } class Split > Node { int splitDimension; int splitPoint; } run { // make single color root from top cell. // let the node schedule its possible splits. root = Node(recognizer.cell()); root.scheduleSplits(); } }