Hi,
I am quite new to PROLOG and I need to write this program, but I have no ideas. I would be very grateful for any help!
Assignment:
Write predicates in PROLOG to solve the folowing problem:
"To find the shortest path between two subway stations in Paris."
Here is the text file (nodes.txt), where his contents is:
* stationFrom - name of the station from where it starts;
* lineFrom - number of metro line from where it starts;
* stationTo - name of the station to where it will arrived;
* lineTo - number of metro line to where it will arrived;
The specified file should be used to generate facts based on
knowledge. There should be a predicate:
solve(StartStation,EndStation,Path).
Who within the arguments StartStation and EndStation are input and refer to the names of the initial and final station respectively, while Path argument is an output argument and a list of names stations that need to pass to get from home to the final station (in shortest way).
Note: The distances between any two stations that have direct connections are equal.
I am quite new to PROLOG and I need to write this program, but I have no ideas. I would be very grateful for any help!
Assignment:
Write predicates in PROLOG to solve the folowing problem:
"To find the shortest path between two subway stations in Paris."
Here is the text file (nodes.txt), where his contents is:
* stationFrom - name of the station from where it starts;
* lineFrom - number of metro line from where it starts;
* stationTo - name of the station to where it will arrived;
* lineTo - number of metro line to where it will arrived;
The specified file should be used to generate facts based on
knowledge. There should be a predicate:
solve(StartStation,EndStation,Path).
Who within the arguments StartStation and EndStation are input and refer to the names of the initial and final station respectively, while Path argument is an output argument and a list of names stations that need to pass to get from home to the final station (in shortest way).
Note: The distances between any two stations that have direct connections are equal.