Getting the range of horizontal distances
let lower = [ ... mp . keys ( ) ] . sort ( ( a , b ) => a - b ) [ 0 ] ; let upper = [ ... mp . keys ( ) ] . sort ( ( a , b ) => b - a ) [ 0 ] ; for ( let i = lower ; i <= upper ; i ++ ) evalComp ( mp . get ( i ) ) ; }