Conversation
Adds the `tile-inSolution` filter to puzzle 007. Also updates the logic for that filter to treat puzzles with empty solutions (`[]`) as including all tiles (rather than none). The in-state solution property is now also properly reset prior to a puzzle being loaded (it is now `undefined` instead of `[]`). This also adds test coverage through solving puzzle 007.
Fixes a bug with removeEmpties removing the empty solution from puzzle 007 from puzzle cache. Also fixed a bug that was causing hidden and placeholder tiles being included in the set of masked tiles.
Various bug fixes were also included in here, such as ensuring there are no duplicate IDs in the puzzle configuration (which was causing issues when trying to de-duplicate tiles by ID, for example). There are still a few bugs left that need to be fixed before merge, see the FIXMEs left behind for them.
There were a few things wrong here. First, the points needed to be rounded, otherwise the cross product would never return 0, and so the points tested were not accurately being determined to be on the line. Second, the code was using state to determine if there had been a reflector collision already, but this was not always accurate depending on the timing of when the beams were being processed. It's easier to just check to see if there is a reflector in the tile the step is occuring in, and then separately handle the case where a reflector collision has already occurred (in which case we can ignore the beam collision and let the reflector handle it, since it is the outgoing reflection step). Lastly, the check for 'is on same side' was not taking zero into account, so it was assuming if both points are on the line they are on the same side, when in reality they could never touch in this case because they would collide with the ends of the reflector. Tests were updated to remove comments and they seem to all be passing now.
kflorence
commented
May 5, 2026
| } | ||
|
|
||
| #updateBeams (resolve) { | ||
| // FIXME: Ensure the beams always process in the same order |
Owner
Author
There was a problem hiding this comment.
Note to self, this was fixed above https://github.com/kflorence/beaming/pull/118/changes#diff-6c4665b25d9b68d0370b33ed75df4ab63d07766cdbf3a36eb36a899237c584dcR250 -- so this comment should be removed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit adds test coverage for the Introductory Puzzle Pack.
Currently it runs through the entire main puzzle and all sub-puzzles
in a single test. May revisit this later, but it works fine for now. I've
also added the output of a share URL in tests when tests conclude
(either pass or fail). This can help troubleshoot test failures, since it
will provide a link to the state of the puzzle when the failure occured,
along with all of the history up to that point.
Fixes #112 and #115:
Adds the
tile-inSolutionfilter to puzzle 007. Also updates the logicfor that filter to treat puzzles with empty solutions (
[]) asincluding all tiles (rather than none). The in-state solution property
is now also properly reset prior to a puzzle being loaded (it is now
undefinedinstead of[]).Fixes a bug with removeEmpties removing the empty solution from puzzle
007 from puzzle cache. Also fixed a bug that was causing hidden and
placeholder tiles being included in the set of masked tiles.
Various bug fixes were also included in here, such as ensuring there
are no duplicate IDs in the puzzle configuration (which was causing issues
when trying to de-duplicate tiles by ID, for example).
Fixes #117:
There were a few things wrong here. First, the points needed to be
rounded, otherwise the cross product would never return 0, and so
the points tested were not accurately being determined to be on the
line. Second, the code was using state to determine if there had been
a reflector collision already, but this was not always accurate depending
on the timing of when the beams were being processed. It's easier to just
check to see if there is a reflector in the tile the step is occuring in,
and then separately handle the case where a reflector collision has
already occurred (in which case we can ignore the beam collision and
let the reflector handle it, since it is the outgoing reflection step).
Lastly, the check for 'is on same side' was not taking zero into account,
so it was assuming if both points are on the line they are on the same
side, when in reality they could never touch in this case because they
would collide with the ends of the reflector.