sclass OneColorTheory { replace Cell with URecognizer.Cell. Theory makeOneColorTheory(Cell cell) { var color = cell.averageColor(); var theory = postIdea("Color of every pixel in $cell is $color.", +cell, +color); testOneColorTheory(cell, theory); ret theory; } void noteCellColor(cell, theory) { var desc = "Pixel check at " + cell; if (theory.hasExampleNamed(desc)) return; var strength = doubleRatio(cell.area(), theory.cell.area()); // how much do we have to say about the cell in the theory? var p = colorDistanceToProbability(cell.averageColor(), theory.color); addExampleToTheory(theory, desc, p, strength); } double colorDistanceToProbability(RGB col1, RGB col2) { ret sqr(colorSimilarity(col1, col2)); } void testOneColorTheory(cell, theory) { noteCellColor(cell, theory); at shouldSplitCell(cell) do: for split, splitProbability in usefulSplits(cell): at splitProbability do: for cell in split: testOneColorTheory(cell, theory/*.branch(description := "recursion to " + cell)*/); } }