diff options
author | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-28 19:47:30 +0100 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@fri.uni-lj.si> | 2016-02-28 19:47:30 +0100 |
commit | 8bd1bb649e4b66ad9f07ab0f04649d4ce7cdd615 (patch) | |
tree | 94b1a7f5e43d5f82004c3b07d1f504f0ee2e2ef4 /server | |
parent | 441bca2319f66a7fd79f350e45fdc5f018e9f2e7 (diff) |
Experiment: prolog_hints
Given an experiment object read from codeq_user in the form
{'id': 'prolog_hints', 'group': 'manual_hints'}
selectively enable only manual hints, automatic hints, or no hints.
This should probably be reverted once the experiment is done.
Diffstat (limited to 'server')
-rw-r--r-- | server/prolog_session.py | 20 |
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) |