wannabe_pilot:
if i add too many entries to my array, the program fails to operate correctly.
I notice that you have a spurious trailing comma in the array declaration. I don't know what effect this would have, but if it causes the array to be created with an extra trailing element which is uninitialised then obviously that would cause havoc.
I haven't tried to muddle through the logic inside get_next_count to figure out how it's supposed to work, but as far as I can see it's called with an argument which is the length of the pattern array, and the return value is used as an index into the array. Along the way it's reading and writing EEPROM values.
Is it sensitive to the initialisation state of the EEPROM? I wonder whether you just happen to have written values to the first seven EEPROM locations, or something like that.
I see the return value is modded by the count_limit so should be a valid index into the array, but have you tried printing out the array index before you use it to make sure?
If you find the array index being used and replace the call to get_next_count() with a hard-coded value, do you still get the problem?