Stores the distance for each cell from the source cell
var d = Array . from ( Array ( ROW ) , ( ) => Array ( COL ) ) ; for ( var i = 0 ; i < ROW ; i ++ ) { for ( var j = 0 ; j < COL ; j ++ ) d [ i ] [ j ] = - 1 ; }