Looking at the field we must first think of a strategy of solving this line following problem. There are rules that the robot must follow and these rules should be programmed in the robot.
The strategy depends largely on the number of the sensors that we have and the features of the line being followed. In our case the line has gaps. Not every line you are going to follow has gaps, but this one has them. Then, it has left and right turns.
The robot must make a number of decisions while following the line. This could be 1, 2, 3...N decisions. Our goal is to group these decisions into as few as possible. From there we would find how many states our State Machine programming pattern should have.
Full course available at