kflorence / beaming

Beaming is a free, open source puzzle game that involves directing beams through a hexagonal grid.
https://kflorence.github.io/beaming/
Other
1 stars 0 forks source link

Fix infinite loop on beam collision #3

Closed kflorence closed 8 months ago

kflorence commented 8 months ago

https://kflorence.github.io/beaming/#/007/eJy1k80KwjAQhN9lziuktrXQN_Aq3kqQYFYIRCNtBEvpu5sUxIoK9e8SlrDzzYTddDAaJYQoQNBsvWpQVh2sat3Jo-zgjeUmFiIeWTyM5_3tqnZeeeMOQZdSJnvCJgih0I_KceXbI4dmOK1nNWRom-ZXVWOz7ArCineWt97V6CUJEvLOLYmE_E2MfBr9w6TFBIs0qucvEenEx76d9LMZfoHPKP8nPqfFP_ELKn6Hn7IljyMeliT5atluSeX10y8Pms-DuuGoYr0OuUPbnBL0F3M4SfY

When beams collide, they will stop at the point of collision, meaning any path that existed after the collision point is removed. In this case, a beam is colliding with another beam that is already colliding with a different beam. When the beam is updated at the collision point, the previous beam it collided with is then free to move again and it collides with the newly colliding beam, which then allows the previously colliding beam to update again ... and so on. Somehow need to determine during a collision if an infinite loop scenario is possible (e.g. that a beam that would be able to update again will not collide with the newly colliding beam).

kflorence commented 8 months ago

FYI: an example of an infinite loop can be found at: https://kflorence.github.io/beaming/#/test_infinite_loop