imansharifi@lenovo-g50-80:~/directory$ prolog Welcome to SWI-Prolog (threaded, 64 bits, version 7.6.4) SWI-Prolog comes with ABSOLUTELY NO WARRANTY. This is free software. Please run ?- license. for legal details. For online help and background, visit http://www.swi-prolog.org For built-in help, use ?- help(Topic). or ?- apropos(Word). ?- consult('maze_planning_prolog.pl'). Language Setting ... The states (maze cells) have been defined. The actions (right,left,up,down) have been defined. Background Knowledge ... The neighborhood relations have been defined. The obstacles (walls) have been defined. true. ?- find_path((3,1),(1,3),Path). left down down left Path = [(3, 1), (2, 1), (2, 2), (2, 3), (1, 3)]. ?- find_path((1,3),(3,1),Path). right up up right Path = [(1, 3), (2, 3), (2, 2), (2, 1), (3, 1)]. ?- find_path((1,3),(2,1),Path). right up up Path = [(1, 3), (2, 3), (2, 2), (2, 1)]. ?- find_path((3,1),(2,3),Path). left down down Path = [(3, 1), (2, 1), (2, 2), (2, 3)].