Well, i got an undirected graph which looks like this.
Each block represents an antenna (in a wireless phone network) and the black line splits the thing into different regions.
We have some facts like:
region(r1, 2110, [1,2]).
region(r2, 2210, [4,5,8]).
region(r3, 2310, [3,6]).
region(r4, 2410, [7,10,11,15]).
region(r5, 2510, [9,12]).
region(r6, 2610, [13,14]).
telephone(2310-6-64221, name(andriopoulos, nikos)).
telephone(2510-12-24234, name(papantoniou, kiki)).
The first parameter is the name of the region, the second is a specific number that will be given to every person in their area (the first 4 numbers at each telephone of the current region) and the third is a list with all the areas that belong to the current region (the next number at the telephone, between the dashes).
My exercise says that every call to the same region is free, if it needs to pass one region is 1, if it is two regions away is two, etc.
I'm assigned to create the can_call/4 function that finds the route and the cost of a specific call between two people.
e.g.
?- can_call(papantoniou, andriopoulos, Route, Cost).
Route = [....]
Cost = ...
I have created a connect/2 function that tells me if 2 blocks are connected but i can't really think anything about the cost.
Any advice?