Skip to content

Fix: steal box not working properly#9

Merged
ormai merged 1 commit into
ormai:mainfrom
Alessandro624:alefix
May 25, 2025
Merged

Fix: steal box not working properly#9
ormai merged 1 commit into
ormai:mainfrom
Alessandro624:alefix

Conversation

@Alessandro624

Copy link
Copy Markdown
Contributor

Problem

When two or more bombs had the same timer value and exploded in the same turn, only the ones still present in self.bombs were considered for propagation. This happened because exploded bombs were already removed from self.bombs during self.tick_bombs().

As a result, in self.propagate_explosions(), the following loop:

for other_bomb in self.bombs:

would miss bombs that had already exploded in the same turn, even though they could still block the explosion chain. This led to explosions incorrectly continuing beyond those bombs, violating the intended behavior.

Test coverage

This fix addresses cases like the test_bomb_steals_box, where two bombs explode in the same turn, one triggering the other. Previously, one bomb could remain incorrectly in self.bombs, or explosions could pass through exploded bombs. After this fix, both bombs are properly removed and propagation behaves as expected.

@ormai ormai merged commit 357d039 into ormai:main May 25, 2025
1 check passed
ormai added a commit that referenced this pull request Sep 17, 2025
Fix: steal box not working properly
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.

2 participants