import { rectsOverlap } from '@datamoc/mw_games/roguelike';
const roomA = { left: 0, top: 0, right: 4, bottom: 4 };
const roomB = { left: 5, top: 0, right: 9, bottom: 4 };
rectsOverlap(roomA, roomB); // false - adjacent, not overlapping
rectsOverlap(roomA, roomB, 2); // true - too close with a 2-cell margin required
Whether two rectangles overlap, optionally requiring
margincells of clearance between them - the checkgenerateDungeonitself uses so rooms never end up sharing a wall.