Skip to content

Fix joseki zone counting bug#220

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

Fix joseki zone counting bug#220
anoek merged 1 commit intomainfrom
joseki

Conversation

@anoek
Copy link
Member

@anoek anoek commented Jan 3, 2026

No description provided.

@github-actions
Copy link

github-actions bot commented Jan 3, 2026

Code Review

I've analyzed this PR and found no bugs or performance issues. The fix correctly addresses a zone counting bug where moves that caused a zone to exit joseki due to adjacency were not being counted in the zone's statistics.

What the fix does:

The PR moves the move counting (moves_in_zone and zone_loss increments) to occur before the adjacency check, ensuring that when a zone exits joseki due to being adjacent to a non-joseki zone, the triggering move is still counted.

Why this is correct:

  • Moves should be counted while the zone is active, including the final move that causes it to exit joseki
  • The early exit via continue is appropriate after marking the zone as inactive
  • Subsequent moves in the now-inactive zone correctly skip counting due to the !zoneState.still_joseki[zone] check

The logic is sound and handles all edge cases correctly (multiple zones per move, early exits, threshold checks).

Approval: ✅ No issues found

@anoek anoek merged commit deaaed5 into main Jan 3, 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