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

id = 140
group = 'trees'
number = 45
visible = True
facts = None

solution = '''\
depthBT(nil, 0).
depthBT(b(L, _, R), D) :-
  depthBT(L, DL),
  depthBT(R, DR),
  (DL >= DR,
   D is DL + 1
   ;
   DL < DR,
   D is DR + 1).
'''