function countBlackWhiteRun(origin, end, matrix, length) {
                        var rise = end.y - origin.y;
                        var run = end.x - origin.x;
                        var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));
                        var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, {
                            x: origin.x - run,
                            y: origin.y - rise
                        }, matrix, Math.ceil(length / 2));
                        var middleValue = towardsEnd.shift() + awayFromEnd.shift() - 1; // Substract one so we don't double count a pixel
                        return (_a = awayFromEnd.concat(middleValue)).concat.apply(_a, towardsEnd);
                        var _a;
                    }
// of the black white run. Takes a length which represents the number of switches from black to white to look for.
of the black white run. Takes a length which represents the number of switches from black to white to look for.
of the black white run . Takes a length which represents the number of switches from black to white to look for .
function countBlackWhiteRun(origin, end, matrix, length) {
                        var rise = end.y - origin.y;
                        var run = end.x - origin.x;
                        var towardsEnd = countBlackWhiteRunTowardsPoint(origin, end, matrix, Math.ceil(length / 2));
                        var awayFromEnd = countBlackWhiteRunTowardsPoint(origin, {
                            x: origin.x - run,
                            y: origin.y - rise
                        }, matrix, Math.ceil(length / 2));
                        var middleValue = towardsEnd.shift() + awayFromEnd.shift() - 1; 
                        return (_a = awayFromEnd.concat(middleValue)).concat.apply(_a, towardsEnd);
                        var _a;
                    }
function countBlackWhiteRun ( origin , end , matrix , length ) { var rise = end . y - origin . y ; var run = end . x - origin . x ; var towardsEnd = countBlackWhiteRunTowardsPoint ( origin , end , matrix , Math . ceil ( length / 2 ) ) ; var awayFromEnd = countBlackWhiteRunTowardsPoint ( origin , { x : origin . x - run , y : origin . y - rise } , matrix , Math . ceil ( length / 2 ) ) ; var middleValue = towardsEnd . shift ( ) + awayFromEnd . shift ( ) - 1 ; return ( _a = awayFromEnd . concat ( middleValue ) ) . concat . apply ( _a , towardsEnd ) ; var _a ; }
of the black white run.
of the black white run .
// Substract one so we don't double count a pixel