distanceRan is a double. It's divided by 40 to give the score shown on screen. I haven't actually done the maths on when this would reach max value of 1.79*10^308, the 17 million years comes from
here.
I had already checked that the counter doesn't stop at 99999, but I looked more closely.
Language: js
distance = this.getActualDistance(distance);
// Score has gone beyond the initial digit count.
if (distance > this.maxScore && this.maxScoreUnits ==
this.config.MAX_DISTANCE_UNITS) {
this.maxScoreUnits++;
this.maxScore = parseInt(this.maxScore + '9', 10);
} else {
this.distance = 0;
}
MAX_DISTANCE_UNITS is always 5 (the number of digits in the distance meter). So this runs once when you reach 99999, but after that maxScoreUnits is 6, so it never runs again. I don't know why they did this, possibly because at 7+ digits it gets cut off the screen, because the X position of the distance meter isn't recalculated.
Therefore once you pass 999999, the score only displays the last 6 digits. I looked at the code history and this behaviour was added in Feb 2015.
Before then, passing 99999 just reset the score to 0.
In the current version, once your distance passes 4*10^22, JS starts representing the score in scientific notation, which breaks the display somewhat.
Once you reach the max of 1.79*10^308 JS represents it as "Infinity" which fully breaks the score display (it's just blank).
All this being said, reaching 999999 takes a bit under 12 hours. It would be quite impressive to bot this with RAM values, considering how many layers you have to go through. And the severe lag probably makes it infeasible through recognising shapes on the screen.