summaryrefslogtreecommitdiff
path: root/prolog/problems/lists
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-17 14:19:45 +0100
committerTimotej Lazar <timotej.lazar@fri.uni-lj.si>2016-03-17 14:19:45 +0100
commitcf4e59c9d6bce337514fc7d77120baced0d6d7bc (patch)
tree33f7cd7d3ae9595ad548427f3a718f5918935e53 /prolog/problems/lists
parenta9416de1d2bde1b2327928717d00d262160912af (diff)
Prolog: split lists exercises into two groups
Diffstat (limited to 'prolog/problems/lists')
-rw-r--r--prolog/problems/lists/count_3/common.py54
-rw-r--r--prolog/problems/lists/count_3/en.py13
-rw-r--r--prolog/problems/lists/count_3/sl.py13
-rw-r--r--prolog/problems/lists/evenlen_1_+_oddlen_1/common.py56
-rw-r--r--prolog/problems/lists/evenlen_1_+_oddlen_1/en.py18
-rw-r--r--prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py18
-rw-r--r--prolog/problems/lists/len_2/common.py49
-rw-r--r--prolog/problems/lists/len_2/en.py13
-rw-r--r--prolog/problems/lists/len_2/sl.py13
-rw-r--r--prolog/problems/lists/max_2/common.py53
-rw-r--r--prolog/problems/lists/max_2/en.py15
-rw-r--r--prolog/problems/lists/max_2/sl.py15
-rw-r--r--prolog/problems/lists/min_2/common.py53
-rw-r--r--prolog/problems/lists/min_2/en.py15
-rw-r--r--prolog/problems/lists/min_2/sl.py15
-rw-r--r--prolog/problems/lists/palindrome_1/common.py54
-rw-r--r--prolog/problems/lists/palindrome_1/en.py15
-rw-r--r--prolog/problems/lists/palindrome_1/sl.py15
-rw-r--r--prolog/problems/lists/rev_2/common.py52
-rw-r--r--prolog/problems/lists/rev_2/en.py15
-rw-r--r--prolog/problems/lists/rev_2/sl.py15
-rw-r--r--prolog/problems/lists/shiftleft_2/common.py50
-rw-r--r--prolog/problems/lists/shiftleft_2/en.py13
-rw-r--r--prolog/problems/lists/shiftleft_2/sl.py13
-rw-r--r--prolog/problems/lists/shiftright_2/common.py50
-rw-r--r--prolog/problems/lists/shiftright_2/en.py13
-rw-r--r--prolog/problems/lists/shiftright_2/sl.py13
-rw-r--r--prolog/problems/lists/sl.py1
-rw-r--r--prolog/problems/lists/sublist_2/common.py53
-rw-r--r--prolog/problems/lists/sublist_2/en.py19
-rw-r--r--prolog/problems/lists/sublist_2/sl.py19
-rw-r--r--prolog/problems/lists/sum_2/common.py49
-rw-r--r--prolog/problems/lists/sum_2/en.py13
-rw-r--r--prolog/problems/lists/sum_2/sl.py13
34 files changed, 0 insertions, 898 deletions
diff --git a/prolog/problems/lists/count_3/common.py b/prolog/problems/lists/count_3/common.py
deleted file mode 100644
index 2953f06..0000000
--- a/prolog/problems/lists/count_3/common.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 120
-number = 27
-visible = False
-facts = None
-
-solution = '''\
-count(_, [], 0).
-count(X, [X|T], N) :-
- count(X, T, NT),
- N is NT + 1.
-count(X, [Y|T], NT) :-
- X \== Y,
- count(X, T, NT).
-'''
-
-test_cases = [
- ('count(a, [], X)',
- [{'X': '0'}]),
- ('count(r, [a, r, b, c, r], X)',
- [{'X': '2'}]),
- ('count(l, [l, l, l, 1, 2, 3], X)',
- [{'X': '3'}]),
- ('count(z, [a, b, c, z, z], X)',
- [{'X': '2'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/count_3/en.py b/prolog/problems/lists/count_3/en.py
deleted file mode 100644
index dd13bc0..0000000
--- a/prolog/problems/lists/count_3/en.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'count/3'
-slug = 'find the number of occurrences of an element in list'
-
-description = '''\
-<p><code>count(X, L, N)</code>: <code>N</code> is the number of times the element <code>X</code> appears in the list <code>L</code>.</p>
-<pre>
-?- count(1, [1,2,1,3,1], N).
- N = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/count_3/sl.py b/prolog/problems/lists/count_3/sl.py
deleted file mode 100644
index 98cd6f8..0000000
--- a/prolog/problems/lists/count_3/sl.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'count/3'
-slug = 'Preštej kolikokrat se element pojavi v seznamu'
-
-description = '''\
-<p><code>count(X, L, N)</code>: <code>N</code> je število kolikokrat se element <code>X</code> pojavi v seznamu <code>L</code>.</p>
-<pre>
-?- count(1, [1,2,1,3,1], N).
- N = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py
deleted file mode 100644
index 1236551..0000000
--- a/prolog/problems/lists/evenlen_1_+_oddlen_1/common.py
+++ /dev/null
@@ -1,56 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 116
-number = 23
-visible = False
-facts = None
-
-solution = '''\
-evenlen([]).
-evenlen([_,_|T]) :-
- evenlen(T).
-
-oddlen([_]).
-oddlen([_,_|T]) :-
- oddlen(T).
-'''
-
-test_cases = [
- ('evenlen([])',
- [{}]),
- ('evenlen([r, w, t, q])',
- [{}]),
- ('\+ evenlen([r, w, t, q, l])',
- [{}]),
- ('\+ oddlen([r, w, t, q])',
- [{}]),
- ('oddlen([r, w, t, q, l])',
- [{}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/en.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/en.py
deleted file mode 100644
index a01a41b..0000000
--- a/prolog/problems/lists/evenlen_1_+_oddlen_1/en.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# coding=utf-8
-
-name = 'evenlen/1 + oddlen/1'
-slug = 'check if the length of a list is even or odd'
-
-description = '''\
-<p><code>evenlen(L)</code>: the list <code>L</code> has an even number of elements.<br />
-<code>oddlen(L)</code>: the list <code>L</code> has an odd number of elements.</p>
-<pre>
-?- oddlen([1,2,3,4,5]).
- true.
-?- oddlen([1,2,3,4]).
- false.
-?- evenlen([1,2,3,4]).
- true.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py b/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py
deleted file mode 100644
index 4ca44c2..0000000
--- a/prolog/problems/lists/evenlen_1_+_oddlen_1/sl.py
+++ /dev/null
@@ -1,18 +0,0 @@
-# coding=utf-8
-
-name = 'evenlen/1 + oddlen/1'
-slug = 'Brez aritmetike preveri, če je seznam sode ali lihe dolžine'
-
-description = '''\
-<p><code>evenlen(L)</code>: seznam <code>L</code> ima sodo število elementov.<br />
-<code>oddlen(L)</code>: seznam <code>L</code> ima liho število elementov.</p>
-<pre>
-?- oddlen([1,2,3,4,5]).
- true.
-?- oddlen([1,2,3,4]).
- false.
-?- evenlen([1,2,3,4]).
- true.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/len_2/common.py b/prolog/problems/lists/len_2/common.py
deleted file mode 100644
index 93a1faa..0000000
--- a/prolog/problems/lists/len_2/common.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 119
-number = 26
-visible = False
-facts = None
-
-solution = '''\
-len([], 0).
-len([_|T], Len) :-
- len(T, LenT),
- Len is LenT + 1.
-'''
-
-test_cases = [
- ('len([8, 3, 5, 1], X)',
- [{'X': '4'}]),
- ('len([2, -3, 5, 0, 3], X)',
- [{'X': '5'}]),
- ('len([], X)',
- [{'X': '0'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/len_2/en.py b/prolog/problems/lists/len_2/en.py
deleted file mode 100644
index 3ca963e..0000000
--- a/prolog/problems/lists/len_2/en.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'len/2'
-slug = 'find the length of a list'
-
-description = '''\
-<p><code>len(L, Len)</code>: <code>Len</code> is the length of the list <code>L</code>.</p>
-<pre>
-?- len([1,2,3], Len).
- Len = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/len_2/sl.py b/prolog/problems/lists/len_2/sl.py
deleted file mode 100644
index 0e98272..0000000
--- a/prolog/problems/lists/len_2/sl.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'len/2'
-slug = 'Izračunaj dolžino danega seznama'
-
-description = '''\
-<p><code>len(L, Len)</code>: <code>Len</code> je dolžina seznama <code>L</code>.</p>
-<pre>
-?- len([1,2,3], Len).
- Len = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/max_2/common.py b/prolog/problems/lists/max_2/common.py
deleted file mode 100644
index 92cf793..0000000
--- a/prolog/problems/lists/max_2/common.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 109
-number = 16
-visible = False
-facts = None
-
-solution = '''\
-max([X], X).
-max([H|T], Max):-
- max(T, Max1),
- ( H > Max1, Max is H
- ;
- H =< Max1, Max is Max1 ).
-'''
-
-test_cases = [
- ('max([15], X)',
- [{'X': '15'}]),
- ('max([22, 13, 81], X)',
- [{'X': '81'}]),
- ('max([42, 42, 42, 42], X)',
- [{'X': '42'}]),
- ('max([-22, -113, -41], X)',
- [{'X': '-22'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/max_2/en.py b/prolog/problems/lists/max_2/en.py
deleted file mode 100644
index c4bc7e2..0000000
--- a/prolog/problems/lists/max_2/en.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'max/2'
-slug = 'find the largest element in list'
-
-description = '''\
-<p><code>max(L, Max)</code>: <code>Max</code> is the largest value in the list <code>L</code>.</p>
-<pre>
-?- max([5,4,1,6], M).
- M = 6.
-?- max([3,2,2], M).
- M = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/max_2/sl.py b/prolog/problems/lists/max_2/sl.py
deleted file mode 100644
index 7a0d07a..0000000
--- a/prolog/problems/lists/max_2/sl.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'max/2'
-slug = 'Poišči največji element v danem seznamu'
-
-description = '''\
-<p><code>max(L, Max)</code>: <code>Max</code> je največji element v seznamu <code>L</code>.</p>
-<pre>
-?- max([5,4,1,6], M).
- M = 6.
-?- max([3,2,2], M).
- M = 3.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/min_2/common.py b/prolog/problems/lists/min_2/common.py
deleted file mode 100644
index 213da5a..0000000
--- a/prolog/problems/lists/min_2/common.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 108
-number = 15
-visible = False
-facts = None
-
-solution = '''\
-min([X], X).
-min([H|T], Min):-
- min(T, Min1),
- ( H < Min1, Min is H
- ;
- H >= Min1, Min is Min1 ).
-'''
-
-test_cases = [
- ('min([15], X)',
- [{'X': '15'}]),
- ('min([22, 13, 81], X)',
- [{'X': '13'}]),
- ('min([42, 42, 42, 42], X)',
- [{'X': '42'}]),
- ('min([-22, 113, 1], X)',
- [{'X': '-22'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/min_2/en.py b/prolog/problems/lists/min_2/en.py
deleted file mode 100644
index 18f45a6..0000000
--- a/prolog/problems/lists/min_2/en.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'min/2'
-slug = 'find the smallest element'
-
-description = '''\
-<p><code>min(L, Min)</code>: <code>Min</code> is the smallest value in the list <code>L</code>.</p>
-<pre>
-?- min([5,4,1,6], M).
- M = 1.
-?- min([3,2,2], M).
- M = 2.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/min_2/sl.py b/prolog/problems/lists/min_2/sl.py
deleted file mode 100644
index 703a05e..0000000
--- a/prolog/problems/lists/min_2/sl.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'min/2'
-slug = 'Poišči najmanjši element v danem seznamu'
-
-description = '''\
-<p><code>min(L, Min)</code>: <code>Min</code> je najmanjši element v seznamu <code>L</code>.</p>
-<pre>
-?- min([5,4,1,6], M).
- M = 1.
-?- min([3,2,2], M).
- M = 2.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/palindrome_1/common.py b/prolog/problems/lists/palindrome_1/common.py
deleted file mode 100644
index e9960c6..0000000
--- a/prolog/problems/lists/palindrome_1/common.py
+++ /dev/null
@@ -1,54 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 112
-number = 19
-visible = False
-facts = None
-
-solution = '''\
-conc112([], L, L).
-conc112([H|T], L2, [H|L]) :-
- conc112(T, L2, L).
-rev112([], []).
-rev112([H|T], R):-
- rev112(T, R1),
- conc112(R1, [H], R).
-palindrome(L) :-
- rev112(L, L).
-'''
-
-test_cases = [
- ('palindrome([])',
- [{}]),
- ('palindrome([a, b, e, A, B, C])',
- [{'A': 'e', 'B': 'b', 'C': 'a'}]),
- ('palindrome([b, e, X])',
- [{'X': 'b'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/palindrome_1/en.py b/prolog/problems/lists/palindrome_1/en.py
deleted file mode 100644
index 48ee8ac..0000000
--- a/prolog/problems/lists/palindrome_1/en.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'palindrome/1'
-slug = 'check if list is a palindrome'
-
-description = '''\
-<p><code>palindrome(L)</code>: the elements of list <code>L</code> are the same when read from the front or back of the list.</p>
-<pre>
-?- palindrome([1,2,3,2,1]).
- true.
-?- palindrome([1,2,3]).
- false.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/palindrome_1/sl.py b/prolog/problems/lists/palindrome_1/sl.py
deleted file mode 100644
index ad67d3f..0000000
--- a/prolog/problems/lists/palindrome_1/sl.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'palindrome/1'
-slug = 'Preveri, če elementi seznama tvorijo palindrom'
-
-description = '''\
-<p><code>palindrome(L)</code>: Elementi seznama <code>L</code> se preberejo v istem vrstnem redu z začetka in s konca seznama.</p>
-<pre>
-?- palindrome([1,2,3,2,1]).
- true.
-?- palindrome([1,2,3]).
- false.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/rev_2/common.py b/prolog/problems/lists/rev_2/common.py
deleted file mode 100644
index 408389a..0000000
--- a/prolog/problems/lists/rev_2/common.py
+++ /dev/null
@@ -1,52 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 111
-number = 18
-visible = False
-facts = None
-
-solution = '''\
-conc111([], L, L).
-conc111([H|T], L2, [H|L]) :-
- conc111(T, L2, L).
-rev([], []).
-rev([H|T], R):-
- rev(T, R1),
- conc111(R1, [H], R).
-'''
-
-test_cases = [
- ('rev([], X)',
- [{'X': '[]'}]),
- ('rev([s, k, c, d, d], X)',
- [{'X': '[d, d, c, k, s]'}]),
- ('rev(X, [s, k, c, d, d])',
- [{'X': '[d, d, c, k, s]'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/rev_2/en.py b/prolog/problems/lists/rev_2/en.py
deleted file mode 100644
index 3ae126e..0000000
--- a/prolog/problems/lists/rev_2/en.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'rev/2'
-slug = 'reverse a list'
-
-description = '''\
-<p><code>rev(L1, L2)</code>: the list <code>L2</code> is obtained from <code>L1</code> by reversing the order of the elements.</p>
-<pre>
-?- rev([1,2,3], X).
- X = [3,2,1].
-?- rev([], X).
- X = [].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/rev_2/sl.py b/prolog/problems/lists/rev_2/sl.py
deleted file mode 100644
index ab58a1c..0000000
--- a/prolog/problems/lists/rev_2/sl.py
+++ /dev/null
@@ -1,15 +0,0 @@
-# coding=utf-8
-
-name = 'rev/2'
-slug = 'Obrni seznam'
-
-description = '''\
-<p><code>rev(L1, L2)</code>: seznam <code>L2</code> ima elemente v obratnem vrstnem redu kot seznam <code>L1</code>.</p>
-<pre>
-?- rev([1,2,3], X).
- X = [3,2,1].
-?- rev([], X).
- X = [].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/shiftleft_2/common.py b/prolog/problems/lists/shiftleft_2/common.py
deleted file mode 100644
index 13db28f..0000000
--- a/prolog/problems/lists/shiftleft_2/common.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 113
-number = 20
-visible = False
-facts = None
-
-solution = '''\
-conc113([], L, L).
-conc113([H|T], L2, [H|L]) :-
- conc113(T, L2, L).
-shiftleft([H|T], L2) :-
- conc113(T, [H], L2).
-'''
-
-test_cases = [
- ('shiftleft([i], X)',
- [{'X': '[i]'}]),
- ('shiftleft([h, e, u, l], X)',
- [{'X': '[e, u, l, h]'}]),
- ('shiftleft([h, A, B, l, c], [x, y, C, D, E])',
- [{'A': 'x', 'B': 'y', 'C': 'l', 'D': 'c', 'E': 'h'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/shiftleft_2/en.py b/prolog/problems/lists/shiftleft_2/en.py
deleted file mode 100644
index a8dd5f0..0000000
--- a/prolog/problems/lists/shiftleft_2/en.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'shiftleft/2'
-slug = 'shift a list left'
-
-description = '''\
-<p><code>shiftleft(L1, L2)</code>: the list <code>L2</code> is obtained from L1 by shifting elements to the left by one (circular shift).</p>
-<pre>
-?- shiftleft([1,2,3,4,5], X).
- X = [2,3,4,5,1].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/shiftleft_2/sl.py b/prolog/problems/lists/shiftleft_2/sl.py
deleted file mode 100644
index ae412a6..0000000
--- a/prolog/problems/lists/shiftleft_2/sl.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'shiftleft/2'
-slug = 'Premakni elemente seznama za eno mesto v levo'
-
-description = '''\
-<p><code>shiftleft(L1, L2)</code>: elemente v seznamu <code>L1</code> za eno mesto premaknemo v levo ("circular shift").</p>
-<pre>
-?- shiftleft([1,2,3,4,5], X).
- X = [2,3,4,5,1].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/shiftright_2/common.py b/prolog/problems/lists/shiftright_2/common.py
deleted file mode 100644
index d8a4c9f..0000000
--- a/prolog/problems/lists/shiftright_2/common.py
+++ /dev/null
@@ -1,50 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 114
-number = 21
-visible = False
-facts = None
-
-solution = '''\
-conc114([], L, L).
-conc114([H|T], L2, [H|L]) :-
- conc114(T, L2, L).
-shiftright(L1, [H|T]) :-
- conc114(T, [H], L1).
-'''
-
-test_cases = [
- ('shiftright([i], X)',
- [{'X': '[i]'}]),
- ('shiftright([h, e, u, l], X)',
- [{'X': '[l, h, e, u]'}]),
- ('shiftright([h, A, B, l, c], [C, D, x, y, E])',
- [{'A': 'x', 'B': 'y', 'C': 'c', 'D': 'h', 'E': 'l'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/shiftright_2/en.py b/prolog/problems/lists/shiftright_2/en.py
deleted file mode 100644
index 63e11cf..0000000
--- a/prolog/problems/lists/shiftright_2/en.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'shiftright/2'
-slug = 'shift a list right'
-
-description = '''\
-<p><code>shiftright(L1, L2)</code>: the list <code>L2</code> is obtained from L1 by shifting elements to the right by one (circular shift).</p>
-<pre>
-?- shiftright([1,2,3,4,5], X).
- X = [5,1,2,3,4].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/shiftright_2/sl.py b/prolog/problems/lists/shiftright_2/sl.py
deleted file mode 100644
index 62fca8d..0000000
--- a/prolog/problems/lists/shiftright_2/sl.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'shiftright/2'
-slug = 'Premakni elemente seznama za eno mesto v desno'
-
-description = '''\
-<p><code>shiftright(L1, L2)</code>: elemente v seznamu <code>L1</code> za eno mesto premaknemo v desno ("circular shift").</p>
-<pre>
-?- shiftright([1,2,3,4,5], X).
- X = [5,1,2,3,4].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/sl.py b/prolog/problems/lists/sl.py
index 0c8dd67..0440a44 100644
--- a/prolog/problems/lists/sl.py
+++ b/prolog/problems/lists/sl.py
@@ -1,5 +1,4 @@
name = 'Seznami'
-description = 'Delo s seznami, poudarek na rekurziji.'
description = '''\
<p>
<a target="_blank" href="[%@resource intro_sl.html%]">Seznami</a>
diff --git a/prolog/problems/lists/sublist_2/common.py b/prolog/problems/lists/sublist_2/common.py
deleted file mode 100644
index 6187ebc..0000000
--- a/prolog/problems/lists/sublist_2/common.py
+++ /dev/null
@@ -1,53 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 117
-number = 24
-visible = False
-facts = None
-
-solution = '''\
-conc117([], L, L).
-conc117([H|T], L2, [H|L]) :-
- conc117(T, L2, L).
-sublist(L, S) :-
- conc117(_, T, L),
- conc117(S, _, T).
-'''
-
-test_cases = [
- ('sublist([], X)',
- [{'X': '[]'}]),
- ('sublist([e, h, A, B, C], [f, a, e])',
- [{'A': 'f', 'B': 'a', 'C': 'e'}]),
- ('sublist([e, A, l, B], [r, C, k])',
- [{'A': 'r', 'B': 'k', 'C': 'l'}]),
- ('setof(L, sublist([a, b, c], L), X)',
- [{'X': '[[], [a], [a, b], [a, b, c], [b], [b, c], [c]]'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/sublist_2/en.py b/prolog/problems/lists/sublist_2/en.py
deleted file mode 100644
index 2697d9b..0000000
--- a/prolog/problems/lists/sublist_2/en.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# coding=utf-8
-
-name = 'sublist/2'
-slug = 'generate sublists of a list'
-
-description = '''\
-<p><code>sublist(L, SL)</code>: <code>SL</code> is a continuous sublist of the list <code>L</code>.</p>
-<pre>
-?- sublist([1,2,3], X).
- X = [] ;
- X = [1] ;
- X = [1,2] ;
- X = [1,2,3] ;
- X = [2] ;
- X = [2,3] ;
- X = [3].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/sublist_2/sl.py b/prolog/problems/lists/sublist_2/sl.py
deleted file mode 100644
index cc42219..0000000
--- a/prolog/problems/lists/sublist_2/sl.py
+++ /dev/null
@@ -1,19 +0,0 @@
-# coding=utf-8
-
-name = 'sublist/2'
-slug = 'Generiraj vse podsezname danega seznama'
-
-description = '''\
-<p><code>sublist(L, SL)</code>: <code>SL</code> je podseznam seznama <code>L</code>. Predikat naj vrne vse možne podsezname, enega po enega.</p>
-<pre>
-?- sublist([1,2,3], X).
- X = [] ;
- X = [1] ;
- X = [1,2] ;
- X = [1,2,3] ;
- X = [2] ;
- X = [2,3] ;
- X = [3].
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/sum_2/common.py b/prolog/problems/lists/sum_2/common.py
deleted file mode 100644
index 000b4b0..0000000
--- a/prolog/problems/lists/sum_2/common.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# coding=utf-8
-
-from operator import itemgetter
-import prolog.engine
-import server.problems
-
-id = 118
-number = 25
-visible = False
-facts = None
-
-solution = '''\
-sum([], 0).
-sum([H|T], Sum) :-
- sum(T, SumT),
- Sum is SumT + H.
-'''
-
-test_cases = [
- ('sum([], X)',
- [{'X': '0'}]),
- ('sum([8, 3, 5, 1], X)',
- [{'X': '17'}]),
- ('sum([2, -3, 5, 0], X)',
- [{'X': '4'}]),
-]
-
-def test(code, aux_code):
- n_correct = 0
- engine_id = None
- try:
- engine_id, output = prolog.engine.create(code=code+aux_code, timeout=1.0)
- if engine_id is not None and 'error' not in map(itemgetter(0), output):
- # Engine successfully created, and no syntax error in program.
- for query, answers in test_cases:
- if prolog.engine.check_answers(engine_id, query=query, answers=answers, timeout=1.0):
- n_correct += 1
- except socket.timeout:
- pass
- finally:
- if engine_id:
- prolog.engine.destroy(engine_id)
-
- hints = [{'id': 'test_results', 'args': {'passed': n_correct, 'total': len(test_cases)}}]
- return n_correct, len(test_cases), hints
-
-def hint(code, aux_code):
- # TODO
- return []
diff --git a/prolog/problems/lists/sum_2/en.py b/prolog/problems/lists/sum_2/en.py
deleted file mode 100644
index b4dab45..0000000
--- a/prolog/problems/lists/sum_2/en.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'sum/2'
-slug = 'find the sum of all elements in list'
-
-description = '''\
-<p><code>sum(L, Sum)</code>: <code>Sum</code> is the sum of all elements in the list <code>L</code>.</p>
-<pre>
-?- sum([1,2,3], Sum).
- Sum = 6.
-</pre>'''
-
-hint = {}
diff --git a/prolog/problems/lists/sum_2/sl.py b/prolog/problems/lists/sum_2/sl.py
deleted file mode 100644
index cc0423b..0000000
--- a/prolog/problems/lists/sum_2/sl.py
+++ /dev/null
@@ -1,13 +0,0 @@
-# coding=utf-8
-
-name = 'sum/2'
-slug = 'Izračunaj vsoto elementov v seznamu'
-
-description = '''\
-<p><code>sum(L, Sum)</code>: <code>Sum</code> je vsota vseh elementov v seznamu <code>L</code>.</p>
-<pre>
-?- sum([1,2,3], Sum).
- Sum = 6.
-</pre>'''
-
-hint = {}