What cruel robot constructor would put obstacles and holes on the line that the bot is supposed to follow?!?
Your code looks like a good start for a newbie programmer. You should try to tab or put brackets in it also to clearly show the blocks of code for example:
if no obstacle
follow the line
go left //getting behind obstacle and perhaps find the line again
This is of course very very pseudo since "follow the line" for example involves a whole steering algorithm of some kind.
A good way to begin might be to do sort of a case study for the sensor input. If we are to simplify the sensors to 1 = object or hole found, 0 = nothing found we could do sort of a table for the four cases:
Sensor 1, Sensor 2, Action
0 0 Run line following algorithm
1 0 Hole detected, run backward maneuver
0 1 Obstacle detected, run obstacle avoiding maneuver
1 1 Hole and obstacle found, run an appropriate maneuver for this case
then you can build upon that with your code:
while(1) //Create an infinite loop
if(sensor1 ==1 and sensor2 == 1)
line following algorithm here...
Ok, this is just an example to show you one way to create code. This code will not work entirely though. See any problem? What happens if both sensors are 1? It will make a backward_maneuver, then an obstacle_maneuver and then finally run some_other_function(). The two first if statements are true then and need to be modified if this code is to be used. (I hope my attempt at being pedagogical didn't complicate things)