Using recursive backtracking to solve Zelda mazes and count enemy encounters