OPTION BASE 1

Started by MrBcx, October 08, 2024, 08:15:24 AM

Previous topic - Next topic

djsb


MrBcx

Yesterday, while working on a new game for you guys to play with, I found a serious but
apparently infrequent bug.  It has existed for a very long time and it was incredibly fortunate
that I was able to spot it.

First off, I rarely need to use OPTION BASE 1 but this was one of those times.

I spent hours trying to track down what I thought was one or more logic errors in my demo. 
Multiple AI helpers basically said the code looked good and gave me endless advise on how to
proceed with debugging the issues.

One line of code from my game, and several others like it, that eventually tipped me off was

                  DIM AS DOUBLE dx = BulletX [ BulletIndex ] - AsteroidX [ i ]

which BCX quickly, silently, and incorrectly  translated to the following

                  double dx = BulletX [ 1 + BulletIndex] - AsteroidX [ 1 + i];


I was able to kill the bug by adding one line of code to the translator that will be included in BCX 8.1.8