function scoreBlackWhiteRun(sequence, ratios) {
                        var averageSize = sum(sequence) / sum(ratios);
                        var error = 0;
                        ratios.forEach(function (ratio, i) {
                            error += Math.pow((sequence[i] - ratio * averageSize), 2);
                        });
                        return {
                            averageSize: averageSize,
                            error: error
                        };
                    }
// that is the amount the run diverges from the expected ratio
that is the amount the run diverges from the expected ratio
that is the amount the run diverges from the expected ratio
function scoreBlackWhiteRun(sequence, ratios) {
                        var averageSize = sum(sequence) / sum(ratios);
                        var error = 0;
                        ratios.forEach(function (ratio, i) {
                            error += Math.pow((sequence[i] - ratio * averageSize), 2);
                        });
                        return {
                            averageSize: averageSize,
                            error: error
                        };
                    }
function scoreBlackWhiteRun ( sequence , ratios ) { var averageSize = sum ( sequence ) / sum ( ratios ) ; var error = 0 ; ratios . forEach ( function ( ratio , i ) { error += Math . pow ( ( sequence [ i ] - ratio * averageSize ) , 2 ) ; } ) ; return { averageSize : averageSize , error : error } ; }
that is the amount the run diverges from the expected ratio
that is the amount the run diverges from the expected ratio