-
Notifications
You must be signed in to change notification settings - Fork 1
refactor: normalize direction in noqx #125
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
- 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 Report❌ Patch coverage is
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. 🚀 New features to boost your workflow:
|
There was a problem hiding this 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_downtoedge(R, C, D)with normalized direction parameters - Renamed line predicates:
grid_direction→line_io,grid_in→line_in,grid_out→line_out - Changed puzzle category from
loop/pathtoroutefor consistency - Renamed loop/path rule modules and APIs to
route - Updated clue labels to use standardized format:
corner_{Direction.XXX}andarrow_{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.
This PR will resolve #123 with the following BREAKING changes:
edgepredicates, they are changed fromedge_top|edge_left|edge_diag_up|edge_diag_downto a unifiededge(R, C, D), and D is normalized to the stardard direction notations.linepredicates,grid_directionis changed toline_io,grid_inis changed toline_inandgrid_outis changed toline_out.loop/pathpuzzles, the category is changed toroutefor unity.loop/pathrules, the module and API is changed toroutefor unity.After the merge, please avoid using hard-coded directions wherever possible.
P.S. The efficiency of the solvers are not compromised by this PR.