@2d-game-grid/square
Version:
A simple square grid made for games
12 lines (11 loc) • 374 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.manhattanDistance = manhattanDistance;
/**
* @param start The start coordinate
* @param end The end coordinate
* @returns The distance between the given coordinates
*/
function manhattanDistance(start, end) {
return Math.abs(start.row - end.row) + Math.abs(start.col - end.col);
}