This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse the repository at this point in the history
Fix behavioural difference from original game (cell overload++)
It is possible when resolving chain reactions that a cell will have atoms added to it by multiple neighbouring explosions before its own explosion is resolved. This means that a central cell could have more than 4 atoms in it (potentially up to 7!), a side cell could have more than 3 (up to 5), and a corner cell more than 2 (up to 3). Our implementation originally discarded any atoms over the explosion threshold, essentially causing us to lose matter. It was determined through use of the debug mode and comparing with the original game that the original does not do this. The fix here is to allow a cell to be overloaded further, and when resolving an explosion in a super-overloaded cell, leave behind any excess atoms in the exploding cell. Interestingly this reveals a display bug in the original game. Viewing the game state at ?debug=84 and comparing to https://youtu.be/kEDjZyG2g-g?t=1m47s the original game is failing to display the green atom present at (9, 4) after that cell has exploded. This is however resolved by the next turn when 1 red atom gets added to the cell, turning it into a 2-atom red cell (showing that it is a display bug rather than a lost atom). This would indicate the the original programmer also struggled somewhat with these edge cases. :)
- Loading branch information
Showing 1 changed file with 34 additions and 17 deletions.