summaryrefslogtreecommitdiff
path: root/server
diff options
context:
space:
mode:
Diffstat (limited to 'server')
-rw-r--r--server/prolog_session.py20
1 files changed, 18 insertions, 2 deletions
diff --git a/server/prolog_session.py b/server/prolog_session.py
index 2920f11..e07a63c 100644
--- a/server/prolog_session.py
+++ b/server/prolog_session.py
@@ -123,6 +123,14 @@ class PrologSession(server.LanguageSession):
problem_module = load_problem(problem.language, problem.group, problem.identifier, 'common')
aux_code = self._aux_code(session.get_uid(), problem, program)
+ # experiment: Prolog hints
+ allowed_hints = 'all'
+ for experiment in session.get_experiments():
+ if experiment.get('id') == 'prolog_hints':
+ allowed_hints = experiment.get('group')
+ break
+ # end of experiment: Prolog hints
+
# check if the program is correct
n_correct, n_all, msgs = problem_module.test(program, aux_code=aux_code)
if n_correct == n_all:
@@ -131,9 +139,17 @@ class PrologSession(server.LanguageSession):
hints = []
if not hints and hasattr(language_module, 'hint'):
hints = language_module.hint(program, aux_code=aux_code)
- if not hints and hasattr(problem_module, 'hint'):
+
+ # experiment: Prolog hints
+ #if not hints and hasattr(problem_module, 'hint'):
+ if not hints and hasattr(problem_module, 'hint') and allowed_hints in ('all', 'manual_hints'):
hints = problem_module.hint(program, aux_code=aux_code)
- if not hints and problem_id in _edits:
+ # end of experiment: Prolog hints
+
+ # experiment: Prolog hints
+ #if not hints and problem_id in _edits:
+ if not hints and problem_id in _edits and allowed_hints in ('all', 'automatic_hints'):
+ # end of experiment: Prolog hints
# Testing function for monkey.
def tester(code):
n_correct, n_all, _ = problem_module.test(code, aux_code=aux_code)