It seems to me that your problem, as indicated, has a trivial solution:
- check hole in current position
- go forward 1 step, check hole
- go back 2 steps, check the hole
- go forward 3 steps, check for a hole
- go back 4 steps, check the hole ...
1. , , , , , . ""; 1-2-3-4-5 , 2 . :
Google " ", N- ( , "" "" )