Skip to content

Creates test coverage for the Introductory Puzzle Pack. Fixes #95#118

Merged
kflorence merged 8 commits into
mainfrom
95
May 5, 2026
Merged

Creates test coverage for the Introductory Puzzle Pack. Fixes #95#118
kflorence merged 8 commits into
mainfrom
95

Conversation

@kflorence
Copy link
Copy Markdown
Owner

@kflorence kflorence commented May 5, 2026

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-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 []).

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.

kflorence added 8 commits May 1, 2026 13:28
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 kflorence merged commit 4812042 into main May 5, 2026
4 checks passed
@kflorence kflorence deleted the 95 branch May 5, 2026 01:18
Comment thread src/components/puzzle.js
}

#updateBeams (resolve) {
// FIXME: Ensure the beams always process in the same order
Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Fix reflector beam collision bug Puzzle 007 should be placeholder until solved

1 participant