AI Prolog Assignment 3

AI Prolog Assignment 3

Assignment 3 [10 marks] try to finish it by Feb 20, 2023 at 11:00 pm
Write a program in PROLOG (you can use another language, however if
you use Prolog you will get 1% bonus) to solve the following maze
Here is part of the file that you will consult:
mazeSize(5,9)
barrier(1, 8).
(barrier(2, 2).
(barrier(2, 4).
barrier(2, 5).
barrier(3, 4)
(barrier(3, 7).
(barrier(3, 9).
(barrier(4, 4).
(barrier(4, 7).
barrier(4, 9).
barrier(5, 2).
which represents the following maze:
Your task is to write a predicate solve (From, To, Path) which, given
locations From and To, finds a Path going
from From to To. From and To are given as two element lists,
and Path should be a list of two-element lists. The first element
of Path should be From, and the last element should be To. Moves can be
made horizontally or vertically, but not diagonally.
For example, solve([3,1], [2,6], [[3,1], [3,2], [3,3], [2,3], [1,3], [1,4], [1,5],
[1,6], [2,6]1). This means; To move from [3,1] to [2,6] a solution as a list
is [[3,1], [3,2], [3,3], [2,3], [1,3], [1,4], [1,5], [1,6], [2,6]1).
There are many solutions, you do not have to come with the optimal
Run your program for [3,1] to [2,6] and for [3,1] to [5,9] and include them
in your report (take a screen shot).