sclass ChessOCR_BoardsFound { sclass ByFEN { double bestScore; Rect bestPosition; Set> boardPositions = synchroSet(); } Map byFEN = synchroMap(); transient L onChange = synchroList(); // L transient L onImprovedScore = synchroList(); // L void add(ChessOCR_RecognizedBoard b) { if (b == null || b.fen == null) ret; ByFEN bf = getOrCreate ByFEN(byFEN, b.fen); bool change; if (b.rectInOriginalImage != null) if (bf.boardPositions.add(pair(b.rectInOriginalImage, b.score))) set change; if (b.score > bf.bestScore) { bf.bestScore = b.score; bf.bestPosition = b.rectInOriginalImage; pcallFAll(onImprovedScore, b.fen, bf.bestPosition); set change; } if (change) pcallFAll(onChange, b.fen); } }