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

id = 158
number = 68
visible = True
facts = None

solution = '''\
memb158(X, [X|_]).
memb158(X, [_|T]) :-
    memb158(X, T).

check158([], _, _).
check158([X/Y | T], R, Xc/Yc) :-
    { (X-Xc)*(X-Xc) + (Y-Yc)*(Y-Yc) =< R*R },
    check158(T, R, Xc/Yc).

center(L, R, Xc/Yc) :-
    memb158(Xc/Yc, L),
    check158(L, R, Xc/Yc).
'''