From d3dd46c458500c7adb020d0338dacd55655137c7 Mon Sep 17 00:00:00 2001 From: Timotej Lazar Date: Wed, 18 Nov 2015 12:42:09 +0100 Subject: Do not handle engine errors in hint functions Such errors are now handled in server.prolog_session. --- prolog/problems/family_relations/ancestor_2/common.py | 3 --- prolog/problems/family_relations/aunt_2/common.py | 3 --- prolog/problems/family_relations/brother_2/common.py | 3 --- prolog/problems/family_relations/cousin_2/common.py | 3 --- prolog/problems/family_relations/descendant_2/common.py | 3 --- prolog/problems/family_relations/father_2/common.py | 3 --- prolog/problems/family_relations/grandparent_2/common.py | 3 --- prolog/problems/family_relations/mother_2/common.py | 3 --- prolog/problems/family_relations/sister_2/common.py | 3 --- 9 files changed, 27 deletions(-) (limited to 'prolog/problems') diff --git a/prolog/problems/family_relations/ancestor_2/common.py b/prolog/problems/family_relations/ancestor_2/common.py index 150e2f0..ec44d41 100644 --- a/prolog/problems/family_relations/ancestor_2/common.py +++ b/prolog/problems/family_relations/ancestor_2/common.py @@ -71,11 +71,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # gender testing is redundant # this is not necessarily wrong, but worth mentioning anyway diff --git a/prolog/problems/family_relations/aunt_2/common.py b/prolog/problems/family_relations/aunt_2/common.py index 9ac91ea..d2051b0 100644 --- a/prolog/problems/family_relations/aunt_2/common.py +++ b/prolog/problems/family_relations/aunt_2/common.py @@ -75,11 +75,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # X and Y mixed up # warning: knowledge base dependent diff --git a/prolog/problems/family_relations/brother_2/common.py b/prolog/problems/family_relations/brother_2/common.py index a370baa..2b45b53 100644 --- a/prolog/problems/family_relations/brother_2/common.py +++ b/prolog/problems/family_relations/brother_2/common.py @@ -69,11 +69,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # X must be male if prolog.engine.ask_truth(engine_id, 'female(X), brother(X, _)'): diff --git a/prolog/problems/family_relations/cousin_2/common.py b/prolog/problems/family_relations/cousin_2/common.py index 16a639c..68c4b34 100644 --- a/prolog/problems/family_relations/cousin_2/common.py +++ b/prolog/problems/family_relations/cousin_2/common.py @@ -82,11 +82,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # gender testing is redundant # this is not necessarily wrong, but worth mentioning anyway diff --git a/prolog/problems/family_relations/descendant_2/common.py b/prolog/problems/family_relations/descendant_2/common.py index 44eb605..0963994 100644 --- a/prolog/problems/family_relations/descendant_2/common.py +++ b/prolog/problems/family_relations/descendant_2/common.py @@ -71,11 +71,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # gender testing is redundant # this is not necessarily wrong, but worth mentioning anyway diff --git a/prolog/problems/family_relations/father_2/common.py b/prolog/problems/family_relations/father_2/common.py index 400c91b..802193d 100644 --- a/prolog/problems/family_relations/father_2/common.py +++ b/prolog/problems/family_relations/father_2/common.py @@ -72,11 +72,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # OR (;) instead of AND (,) # this hint has to be before the next two diff --git a/prolog/problems/family_relations/grandparent_2/common.py b/prolog/problems/family_relations/grandparent_2/common.py index 1657509..ff94f31 100644 --- a/prolog/problems/family_relations/grandparent_2/common.py +++ b/prolog/problems/family_relations/grandparent_2/common.py @@ -73,11 +73,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # TODO: generic hint for: # TODO: parent(X, Z1), parent(Z2, Y), Z1 = Z2 diff --git a/prolog/problems/family_relations/mother_2/common.py b/prolog/problems/family_relations/mother_2/common.py index 21bf300..2fb2722 100644 --- a/prolog/problems/family_relations/mother_2/common.py +++ b/prolog/problems/family_relations/mother_2/common.py @@ -73,11 +73,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # OR (;) instead of AND (,) # this hint has to be before the next two diff --git a/prolog/problems/family_relations/sister_2/common.py b/prolog/problems/family_relations/sister_2/common.py index b09b29a..6a1a745 100644 --- a/prolog/problems/family_relations/sister_2/common.py +++ b/prolog/problems/family_relations/sister_2/common.py @@ -95,11 +95,8 @@ def hint(program, solved_problems): 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) - if not engine_id: - raise Exception('Prolog engine failed to create.') # X must be female if prolog.engine.ask_truth(engine_id, 'male(X), sister(X, _)'): -- cgit v1.2.1