[Community Puzzle] Annihilation

Your example is correct. The two arrows aren’t destroyed, and the configuration repeats forever.

Although the puzzle constraints don’t explicitly forbid such cases, there aren’t such cases in the puzzle. Every case eventually terminates.

Could you give me an example of the timeout you’re seeing?

  • Which test is it failing on?
  • If you’ve identified a repeating cycle, could you share the state of the grid from the initial state up to the beginning of the cycle?

That’d help me determine at which step your code has gone wrong.

After some attempts to get a minimal reproducible problem for you, I finally managed to find my issue. I’m posting this in case it helps someone later.

2 7
.>^.<^.
..^vv..

In this example, at the 3rd column, there are two ^. While moving them, at one time, both were on the same cell and I didn’t handle this case properly, so my code erased one of them.

I now pass more tests (all but the last 2) and validators (all but the last one) due to performance issues (ran the tests locally and they both finish after some time).

Thanks for your guidance, you helped me to narrow the search down !

EDIT: The performance matter was only caused by debug prints at each iteration, so now I completed the puzzle ^^

1 Like