Bram-Hub / LEGUP

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

[BUG] Bizzarre Satify Number behavior #555

Closed Bram28 closed 4 months ago

Bram28 commented 1 year ago

Description

OK, really bizarre one ... I have a case rule that checks out when it should clearly not

Steps to Reproduce

First I do some initial moves. So far so good:

image

Now I put a lightbulb to the right of the 2 ... and select the Case Rule 'Satify Number':

image

Oops! This should not check out. And strangely, it does not check out when the very top right square is not lit up. For example:

image

I really have no idea what could lead to this behavior ... someone will have to trace this

Expected Behavior

As explained above, the rule should not check out

Screenshots

No response

Puzzle Files

No response

Additional Context

No response

charlestian23 commented 5 months ago

Ok, after a multitude of testing this week, I have come to the conclusion that this is a general bug with case rules. I believe once a transition is present like this: image even if there are no actual changes present on the board, the case rule checker starts to act strangely. This is because many of the case rules rely on parent.getChildren() for error checking. By making a modification to the board, we set the number of children to 1. However, in the case of Satisfy Number, you are allowed to have 1 child, and so this results in the rule missing the error check.

I have also verified this is an engine-wide bug with testing on Nurikabe:

  1. Open any LEGUP Nurikabe puzzle
  2. Make any modification to the board
  3. Click on the cells you modified and change them back to unknown. At this point, there should be no difference between the starting board and the board currently on your screen, but there should exist a transition on the tree in the TreeView.
  4. Attempt to use the Black or White case rule, which should be allowed to be used at this point.
  5. Note that LEGUP creates a new node with a red transition.

A possible solution I will explore is deleting this arrow on any call of a case rule. I'm not sure how this is possible right now and will need to do more testing to figure out how to implement this.

Chase-Grajeda commented 4 months ago

Fixed by #755