Skip to content

Conversation

@T0nyX1ang
Copy link
Owner

This PR will resolve #123 with the following BREAKING changes:

  • For edge predicates, they are changed from edge_top | edge_left | edge_diag_up | edge_diag_down to a unified edge(R, C, D), and D is normalized to the stardard direction notations.
  • For line predicates, grid_direction is changed to line_io, grid_in is changed to line_in and grid_out is changed to line_out.
  • For loop/path puzzles, the category is changed to route for unity.
  • For loop/path rules, the module and API is changed to route for unity.
  • For line elements, the directions and labels are separated.
  • For sudoku_x labels, they are changed to corner_{Direction.XXX}.
  • For arrowed numbers (yaji-like), the labels of them are changed to arrow_{Direction.XXX}.
  • Fix numberlink (bit version) loading issues.

After the merge, please avoid using hard-coded directions wherever possible.

P.S. The efficiency of the solvers are not compromised by this PR.

- The hard coded directions are relieved in this change.
- change edge_left(R, C)/edge_top(R, C) to edge(R, C, "D")
- D is a normalized direction defined in Direction
- All the loops and paths are changed to routes for unity.
- The shading colors are set to `green` if possible.
This API has been merged into the `fill_line` API
@codecov
Copy link

codecov bot commented Jan 9, 2026

Codecov Report

❌ Patch coverage is 99.61759% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 99.68%. Comparing base (4651d5e) to head (bbe4008).
⚠️ Report is 32 commits behind head on dev.

Files with missing lines Patch % Lines
noqx/manager.py 75.00% 0 Missing and 2 partials ⚠️
noqx/puzzle/penpa.py 95.83% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##              dev     #125      +/-   ##
==========================================
+ Coverage   99.66%   99.68%   +0.02%     
==========================================
  Files         157      157              
  Lines        7412     7366      -46     
  Branches      952     1015      +63     
==========================================
- Hits         7387     7343      -44     
+ Misses         12       11       -1     
+ Partials       13       12       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This pull request implements a comprehensive refactoring to normalize direction handling in the noqx puzzle solver framework. The changes standardize how directions are represented across edge predicates, line predicates, and puzzle categories, moving from string-based and varied naming to a unified Direction enum-based approach.

Key Changes:

  • Unified edge predicates from edge_top, edge_left, edge_diag_up, edge_diag_down to edge(R, C, D) with normalized direction parameters
  • Renamed line predicates: grid_directionline_io, grid_inline_in, grid_outline_out
  • Changed puzzle category from loop/path to route for consistency
  • Renamed loop/path rule modules and APIs to route
  • Updated clue labels to use standardized format: corner_{Direction.XXX} and arrow_{Direction.XXX}
  • Updated development dependencies (black, conventional-pre-commit, ruff)
  • Fixed numberlink bit version loading issues

Reviewed changes

Copilot reviewed 98 out of 99 changed files in this pull request and generated no comments.

File Description
uv.lock Updated dependency versions for black, conventional-pre-commit; split Python 3.8 dependencies separately
pyproject.toml Updated version constraints for dev dependencies
tests/test_solver.py Added compass_constraint test, hinge edge case test, improved error messages
solver/*.py (60+ files) Migrated from string-based directions to Direction enum, edge_* to edge(), loop to route category, updated display() calls

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@T0nyX1ang T0nyX1ang merged commit 345457b into dev Jan 9, 2026
15 of 16 checks passed
@T0nyX1ang T0nyX1ang deleted the normalize_direction branch January 15, 2026 16:26
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