Skip to content

Improve joseki detection#219

Merged
anoek merged 1 commit intomainfrom
joseki
Jan 2, 2026
Merged

Improve joseki detection#219
anoek merged 1 commit intomainfrom
joseki

Conversation

@anoek
Copy link
Member

@anoek anoek commented Jan 2, 2026

No description provided.

@github-actions
Copy link

github-actions bot commented Jan 2, 2026

Code Review

I've reviewed this PR and found one potential bug:

Bug: Center intersection ignored in joseki detection

Location: src/engine/ai/categorize.ts:278-280 (in the new getZones function)

The new code returns an empty array when a move is placed at the exact center intersection on boards 13x13 or larger:

// Center intersection is ignored (no zones)
if (inVerticalBand && inHorizontalBand) {
    return [];
}

Issue: When getZones() returns an empty array, the move won't be tracked in any zone for joseki detection. The loop in detectJosekiMoves (line 411) will simply skip over it:

for (const zone of zones) {  // zones is empty [], so loop never executes
    if (!zoneState.still_joseki[zone]) {
        continue;
    }
    // ... joseki tracking logic
}

Impact: Center point moves (tengen) won't be counted toward joseki move limits or score loss thresholds in any zone. While tengen isn't common in traditional joseki, this could lead to unexpected behavior where center moves are silently excluded from analysis.

Suggestion: Consider whether center moves should belong to all 4 middle zones (4,5,6,7) instead of being excluded entirely, or document why center moves are intentionally ignored.

@anoek anoek merged commit 8535104 into main Jan 2, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants