Help for following line competition


I’m a college student, i have a competition this month , i bought the mbot robot
The competition is a robot follow a non continued black line and avoid obstacles.

The problem all cods in internet of mbot is for continued black line and when it find the white color it return backward.

I use this code followLineAndAvoidObstacle.sb2 its working but the problem when the mbot find and discontinued black line return to backward (______ _________ __________) I need it continue when find white line and find the black line again

"Or if you have other solution"
Can please help me to fix this problem
I want to win this competition and i don’t have much time
(sorry for my English)

Please help