Closed T0nyX1ang closed 1 month ago
The bug is pinpointed now.
In the pipelink solver, @zhuyaoyu adds several checks in the common.py -> fill_path()
function:
if directed:
rule = f"{{ grid_in(R, C, D): direction(D) }} <= 1 :- grid(R, C), {color}(R, C).\n"
rule += f"{{ grid_out(R, C, D): direction(D) }} <= 1 :- grid(R, C), {color}(R, C)."
+ rule += f"not grid_in(R, C, D) :- grid(R, C), direction(D), not {color}(R, C)."
+ rule += f"not grid_out(R, C, D) :- grid(R, C), direction(D), not {color}(R, C)."
else:
rule = f"{{ grid_direction(R, C, D): direction(D) }} :- grid(R, C), {color}(R, C)."
+ rule += f"not grid_direction(R, C, D) :- grid(R, C), direction(D), not {color}(R, C)."
However, this function conflicts with the color definition in firefly(hotaru beam)
solver:
# in restrict_bend function
rule += "firefly_all(R, C) :- firefly(R, C).\n"
rule += "firefly_all(R, C) :- dead_end(R, C).\n"
# in the main solver
solver.add_program_line("{ firefly(R, C) } :- grid(R, C), not dead_end(R, C).")
solver.add_program_line(fill_path(color="firefly", directed=True))
In this way, the rule in fill_path
will check 'flrefly(R, C)' instead of firefly_all(R, C)
, which leads to ignoring dead_end(R, C)
that also has a grid_direction(R, C)
. This will fail the rules newly added.
Fortunately, we find that removing these rules will not influence the Pipe Link
solver, and we decide to remove these lines. The commit is just a rollback which will not have any side effects.
Fixed in commit bc87911.
Please give the link to the puzzle which causes the bug:
Please give reproduce steps if possible: