This is one of the more challenging of tasks I’ve solved in my preparation of the JS Exam:
Given a cuboid made from cubes with. It’s width, height and depth are known. From a given startpoint a laser is shot in one of 26 directions. Direction is a 3D vector (i.e. (1,-1,1) will move to the right,down (up in my draw), deeper(right-er) in every turn). The laser burns cubes that it passes through and stops when a burned cube has been reached. The red,green and blue cubes in the picture are burned on the start so they will never be the answer.
In the console part I print out a cuboid current state. On the left is the close wall and on the right the back wall . Every move of the ‘laser‘ is represented by a 5 for better view. Every draw is a new move.