Skip to content

Comments

Enforce connectivity in LitsSolver#70

Merged
newtomsoft merged 2 commits intodevelopfrom
lits-connectivity-fix-7783139351858898744
Dec 25, 2025
Merged

Enforce connectivity in LitsSolver#70
newtomsoft merged 2 commits intodevelopfrom
lits-connectivity-fix-7783139351858898744

Conversation

@google-labs-jules
Copy link
Contributor

This PR addresses the issue where LitsSolver would sometimes return solutions with disconnected groups of shaded cells (LITS shapes), violating the puzzle's connectivity rule.

Changes:

  • Modified Domain/Puzzles/Lits/LitsSolver.py:
    • Refactored get_solution to use an iterative loop.
    • Added _add_connectivity_constraints to dynamically add constraints forbidding disconnected components (lazy constraints).
    • Imported ShapeGenerator to assist with neighbor identification for component constraints.
    • Updated get_solution to use Grid.get_all_shapes instead of Grid.get_connected_positions to safely identify connected components without StopIteration errors.
  • Modified Domain/Puzzles/Lits/tests/LitsSolver_test.py:
    • Added a check_connectivity helper method.
    • Updated existing test cases (test_solution_6x6_normal, test_solution_6x6_hard, etc.) to assert that the returned solution is fully connected.

The solution was verified by running the existing test suite, which now explicitly checks for connectivity.


PR created automatically by Jules for task 7783139351858898744 started by @newtomsoft

Implemented an iterative solve-check-block loop in `LitsSolver` to enforce that all shaded cells form a single connected component (polyomino). This mirrors the strategy used in `NurikabeSolver`. Added connectivity assertions to `LitsSolver_test.py` to verify the fix and prevent regression.
@google-labs-jules
Copy link
Contributor Author

👋 Jules, reporting for duty! I'm here to lend a hand with this pull request.

When you start a review, I'll add a 👀 emoji to each comment to let you know I've read it. I'll focus on feedback directed at me and will do my best to stay out of conversations between you and other bots or reviewers to keep the noise down.

I'll push a commit with your requested changes shortly after. Please note there might be a delay between these steps, but rest assured I'm on the job!

For more direct control, you can switch me to Reactive Mode. When this mode is on, I will only act on comments where you specifically mention me with @jules. You can find this option in the Pull Request section of your global Jules UI settings. You can always switch back!


For security, I will only act on instructions from the user who triggered this task.

New to Jules? Learn more at jules.google/docs.

@github-actions
Copy link

github-actions bot commented Dec 25, 2025

Qodana Community for Python

125 new problems were found

Inspection name Severity Problems
Missing await syntax in coroutine calls 🔶 Warning 36
Redeclared names without usages 🔶 Warning 20
Unused imports 🔶 Warning 19
Invalid type hints definitions and usages 🔶 Warning 8
Unbound local variables 🔶 Warning 5
Unused local symbols ◽️ Notice 19
Shadowing names from outer scopes ◽️ Notice 8
Method is not declared static ◽️ Notice 5
An instance attribute is defined outside init`` ◽️ Notice 2
Unclear exception clauses ◽️ Notice 2
Invalid abstract class definition and usages ◽️ Notice 1

☁️ View the detailed Qodana report

Contact Qodana team

Contact us at qodana-support@jetbrains.com

… constraints, and re-enable hard path test
@newtomsoft newtomsoft marked this pull request as ready for review December 25, 2025 19:17
@newtomsoft newtomsoft self-requested a review December 25, 2025 19:17
@newtomsoft newtomsoft merged commit e8c7bb2 into develop Dec 25, 2025
5 checks passed
@newtomsoft newtomsoft deleted the lits-connectivity-fix-7783139351858898744 branch December 25, 2025 19:20
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.

1 participant