private boolean hasPairedExit(int row, int col, Direction dir) { if (row < 0 || row >= this.nRows) return false; if (col < 0 || col >= this.nCols) return false; GameObject obj = this.getObjectFromCoords(row, col); if (obj == null) return false; Point startCoords = this.getStartCoords(row, col); return obj.hasExitAt(row - startCoords.x, col - startCoords.y, dir.opposite()); }