summaryrefslogtreecommitdiff
path: root/prolog/problems/family_relations/father_2
diff options
context:
space:
mode:
Diffstat (limited to 'prolog/problems/family_relations/father_2')
-rw-r--r--prolog/problems/family_relations/father_2/common.py16
1 files changed, 9 insertions, 7 deletions
diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py
index ba6a166..dd799e7 100644
--- a/prolog/problems/family_relations/father_2/common.py
+++ b/prolog/problems/family_relations/father_2/common.py
@@ -27,7 +27,7 @@ hint_type = {
'y_need_not_be_parent': Hint('y_need_not_be_parent'),
}
-def test(session, program):
+def test(program, solved_problems):
# TODO: change queries and answers (these are for sister/2)
# Test queries and expected answers (values of X).
queries = [
@@ -36,7 +36,9 @@ def test(session, program):
('sister(X, _)', set(['michelle', 'daniela', 'patricia', 'luana', 'sally', 'melanie', 'nevia', 'vanessa', 'anna'])),
]
- code = program + '\n' + server.problems.load_facts('prolog', facts).facts
+ code = (program + '\n' +
+ server.problems.solutions_for_problems('prolog', solved_problems) + '\n' +
+ server.problems.load_facts('prolog', facts).facts)
engine_id = None
try:
@@ -57,13 +59,13 @@ def test(session, program):
return n_correct, len(queries)
-def general_hint():
- pass
-
-def hint(session, program):
+def hint(program, solved_problems):
tokens = prolog.util.tokenize(program)
- code = program + '\n' + server.problems.load_facts('prolog', facts).facts
+ code = (program + '\n' +
+ server.problems.solutions_for_problems('prolog', solved_problems) + '\n' +
+ server.problems.load_facts('prolog', facts).facts)
+
engine_id = None
try:
engine_id, output = prolog.engine.create(code=code, timeout=1.0)