summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/connected_3/common.py
blob: 9c0bef71273bcfd4c35f7988f87dabbd091362ec (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# coding=utf-8

id = 102
number = 9
visible = True
facts = 'family_relations'

solution = '''\
connected(X, X, _).
connected(X, Y, N) :-
  N > 0,
  N1 is N - 1,
  ( parent(X, Z)
    ;
    parent(Z, X) ),
  connected(Z, Y, N1).
'''