this method ignores ambient light, but you need at least 3 sensors for it
do this pseudocode as a loop:
store each sensor value in an array
array = [sensor1, sensor2, sensor3, sensor4, sensor5]
now find the maximum and 2nd maximum value of these equations:
(a maximum means a line edge is detected there)
lets assume B and C are the highest -> that means the line is between B and C.
if the highest were A and B, that means the line is on the left, so you need to turn left.
its basically edge detection with photoresistors.as for the ambient light problem
suppose its dark in a room and your robot runs the thresholding algorithm. now your robot goes halfway down the course, then suddenly really bright sunlight comes in the windows -> the thresholds now become invalid and your robot starts attacking kittens