function countAdjacentMines()

in src/gemini_95/index.ts [1281:1299]


    function countAdjacentMines(row: number, col: number): number {
        let count = 0;
        for (let dr = -1; dr <= 1; dr++) {
            for (let dc = -1; dc <= 1; dc++) {
                if (dr === 0 && dc === 0) continue; // Skip self
                const nr = row + dr;
                const nc = col + dc;

                if (
                    nr >= 0 && nr < minesweeperGridSize.rows &&
                    nc >= 0 && nc < minesweeperGridSize.cols &&
                    grid[nr][nc].isMine
                ) {
                    count++;
                }
            }
        }
        return count;
    }