From 80881f3a6b05474fcd5afe7b3ed30cc7e75e4a92 Mon Sep 17 00:00:00 2001 From: Aleksander Sadikov Date: Tue, 1 Mar 2016 01:09:07 +0100 Subject: Improved hints for ancestor/2 and descendant/2. --- prolog/problems/family_relations/ancestor_2/common.py | 3 ++- prolog/problems/family_relations/ancestor_2/sl.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) (limited to 'prolog/problems/family_relations/ancestor_2') diff --git a/prolog/problems/family_relations/ancestor_2/common.py b/prolog/problems/family_relations/ancestor_2/common.py index d2e4f76..6690e00 100644 --- a/prolog/problems/family_relations/ancestor_2/common.py +++ b/prolog/problems/family_relations/ancestor_2/common.py @@ -29,6 +29,7 @@ hint_type = { 'ancestor_to_oneself': Hint('ancestor_to_oneself'), 'descendant_need_not_be_parent': Hint('descendant_need_not_be_parent'), 'wrong_direction': Hint('wrong_direction'), + 'timeout': Hint('timeout'), } test_cases = [ @@ -105,7 +106,7 @@ def hint(code, aux_code): return [{'id': 'descendant_need_not_be_parent'}] except socket.timeout as ex: - pass + return [{'id': 'timeout'}] finally: if engine_id: diff --git a/prolog/problems/family_relations/ancestor_2/sl.py b/prolog/problems/family_relations/ancestor_2/sl.py index 081732b..03e9230 100644 --- a/prolog/problems/family_relations/ancestor_2/sl.py +++ b/prolog/problems/family_relations/ancestor_2/sl.py @@ -63,6 +63,10 @@ Skratka, poskusi prevesti na "manjši" problem, npr. prednik v enem koraku manj

Si morda sprogramiral ravno obratno in zamenjal prednika s potomcem? X naj bo prednik od Y in ne obratno!

+''', + + 'timeout': '''\ +

Je morda na delu potencialno neskončna rekurzija?

''', } -- cgit v1.2.1