From 95e2fe57f6e4639f6ae9f1fef368829d5090dbf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ale=C5=A1=20Smodi=C5=A1?= Date: Tue, 18 Aug 2015 16:06:19 +0200 Subject: Exported all problems from the SQLite database into the new directory structure. --- prolog/problems/clp_r/center_3/common.py | 20 ++++++++++++++++++++ prolog/problems/clp_r/center_3/en.py | 13 +++++++++++++ 2 files changed, 33 insertions(+) create mode 100644 prolog/problems/clp_r/center_3/common.py create mode 100644 prolog/problems/clp_r/center_3/en.py (limited to 'prolog/problems/clp_r/center_3') diff --git a/prolog/problems/clp_r/center_3/common.py b/prolog/problems/clp_r/center_3/common.py new file mode 100644 index 0000000..1474ef1 --- /dev/null +++ b/prolog/problems/clp_r/center_3/common.py @@ -0,0 +1,20 @@ +id = 158 +group = 'clp_r' +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). +''' diff --git a/prolog/problems/clp_r/center_3/en.py b/prolog/problems/clp_r/center_3/en.py new file mode 100644 index 0000000..b2b4c8d --- /dev/null +++ b/prolog/problems/clp_r/center_3/en.py @@ -0,0 +1,13 @@ +id = 158 +name = 'center/3' +slug = 'find central points' + +description = '''\ +

center(Points, R, X/Y): X/Y is a point in the list Points that is at most R away from all other points.

+
+  ?- center([1.0/1.1, 2.0/2.1, 3.0/3.1, 4.0/4.1], 4.0, X/Y).
+    X = 2.0, Y = 2.1 ;
+    X = 3.0, Y = 3.1.
+
''' + +hint = {} -- cgit v1.2.1