Bram-Hub / LEGUP

Logic Engine for Grid-Using Puzzles - a better way to learn formal logic
GNU General Public License v3.0
33 stars 82 forks source link

[BUG] Case Rules Called Multiple Times #724

Open cadogs opened 8 months ago

cadogs commented 8 months ago

Description

In adding a new Nurikabe case rule I found that case rules call itself multiple times. If you put a print statement at the start of the get cases function you'll see that it gets printed multiple times in the BlackOrWhite case rule class and the finish room case rule that may or may not be implemented when you view this. I haven't looked too far into it but in the CaseRule.java class the bottom method "dependentElements" seems to be the source of calling it multiple times. Is this really necessary? Running multiple times doesn't seem to change the function of either case rule but it does increase runtime slightly.

Steps to Reproduce

Add print statement at the start of BlackOrWhiteCaseRule.java method "getCases". Then open up any Nurikabe board and use the Black or White case rule.

Expected Behavior

Only run the getCases function once if it isn't absolutely necessary to run it multiple times

Screenshots

No response

Puzzle Files

No response

Additional Context

No response

charlestian23 commented 8 months ago

Whoever is working on this bug should also check if this is a Nurikabe specific issue or if this issue is present for other puzzles as well.