It is hard to answer your question without giving away anything but there are two ways you can do this:
1. Use the find hazard function in a loop
2. If you need to move down add side but subtract sideStep, and if you need to move up, add side and add sideStep.
Lost Viking is basically a trial and error game. Keep on testing and improving your code!
Best of Luck!