Line fallower Robot

Hello,
We ve got a huge problem concerning this case,
I explain:
the robot starts from the part indicated in yellow [start], then he meets the first intersection of the two lines the robot has to go forward fallowing the line, then he meets the second intersection, here he has to turn left,
then again he meets with the intersection he goes forward fallowing the line the next intersection he turns left ( so it makes a loop).

the problem we faced concerning programming (using Two IR detectors) was the incrementation of “for” (for(int i =0;i<(somevalue); i++):
when the detectors are in the black line the value of i changes fast, while we need it to be changed once IR detectors detect together the black line so we can guide it.
any help?^^