Need Idea line follower

guys i have competition
any idea how to code line follower for that arena ? i dont know the best ? using count or flag ?
plz help

Look up 'finite state machine'.