Let's say I have a matrix of N lines and N columns. Let's take N = 5. How can I make a .pl program which returns me a list of N random pairs in which the distance between any pair is minimum 2? A pair is of form (i, j), where i represents the line and j represents the column of an element. I made the distance function:
dist(X1, Y1, X2, Y2, D) :-
D is round(sqrt((X2 - X1)**2 + (Y2 - Y1)**2)).
The main should look like this:
?- L = []
?- make_list(L).
L = [pair(5,5), pair(1,1), pair(3, 3), pair(1,5), pair(5, 1)]
Can you give me any useful piece of code or at least some ideas?