A direction to a goal is provided by planning and setting the related facts. A detailed description of the learning…