how to handle very large array?

Matheus matheus at
Mon Feb 14 13:50:57 UTC 2022

On Monday, 14 February 2022 at 13:20:45 UTC, MichaelBi wrote:
> thanks, you are all correct. i just change the algorithm and 
> use the AA, previously using the naïve method...:), now solved 
> perfectly. thanks again.

You could have used a normal Int Array for this task too, you're 
dealing with numbers and could go with array of 9 elements 0..8, 
then move data circularly and adding new lives as hit -1.

I pretty sure there is a Mathematical way to solve this, I mean 
without any Arrays, but I didn't bother about it since that even 
my basic JavaScript implementation runs in less than 1ms for 256 
days in an old computer.


More information about the Digitalmars-d-learn mailing list