Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Neverending loop
#14
@KernelPanic As I mentioned, the code *as written* has no bugs in it -- but it does, indeed, have the potential to become an endless loop. Let me illustrate how:

***
***
***

Now, imagine I print the above in _FONT 8. Font 8 is perfectly square -- 8 pixels wide, 8 pixels high.

Now, also imagine that it's centered on the screen and I decide to explode it in 8x8 boxes.

Explosion speed is calculated as the distance from the center...

How far would that 2nd * on the 2nd row be from the center??

0.0 pixels!! It is *exactly* centered, so its movement speed would become 0.

If it never moves, it'll never clear the screen, resulting in an endless loop.



As written, the code truly isn't bugged -- but it has the potential to become so with the proper data set.

If one wanted to "fix" it, the best way would be to add a line for a movement check:

IF Array(x, y).changex + Array(x, y).changey < 1 THEN .... not enough movement, do some fixing!

Then you can choose whatever method you like to fix the issue. Evaporate the block. Explode it off in a random "richotte" direction. Whatever fix floats your boat to make certain movement is always not so low that it causes insufferable program delay. Wink
Reply


Messages In This Thread
Neverending loop - by SMcNeill - 07-30-2022, 03:18 AM
RE: Neverending loop - by Pete - 07-30-2022, 03:42 AM
RE: Neverending loop - by Pete - 07-30-2022, 04:08 AM
RE: Neverending loop - by bplus - 07-30-2022, 05:02 AM
RE: Neverending loop - by TempodiBasic - 08-02-2022, 01:08 PM
RE: Neverending loop - by bplus - 07-30-2022, 05:11 AM
RE: Neverending loop - by Pete - 07-30-2022, 05:26 AM
RE: Neverending loop - by SMcNeill - 07-30-2022, 03:13 PM
RE: Neverending loop - by bplus - 07-30-2022, 03:43 PM
RE: Neverending loop - by Pete - 07-30-2022, 03:45 PM
RE: Neverending loop - by Kernelpanic - 07-30-2022, 09:54 PM
RE: Neverending loop - by bplus - 08-02-2022, 03:42 PM
RE: Neverending loop - by Kernelpanic - 08-02-2022, 05:03 PM
RE: Neverending loop - by admin - 08-02-2022, 06:59 PM
RE: Neverending loop - by Kernelpanic - 08-02-2022, 07:51 PM
RE: Neverending loop - by TempodiBasic - 08-04-2022, 12:43 AM



Users browsing this thread: 3 Guest(s)