summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-01-22 16:40:14 +0100
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:01 +0200
commit89b962e31b8d2dea124b8293b5d263f365d8bbeb (patch)
treec2dd663ea5f56b3e0be728e44cc6c186d1e2c2fc
parent1cba40a960965fb3ffeb3bee8635c2c899001d6b (diff)
Add support for hint generation
-rwxr-xr-xmonkey/monkey.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/monkey/monkey.py b/monkey/monkey.py
index 693aa67..9e70a3f 100755
--- a/monkey/monkey.py
+++ b/monkey/monkey.py
@@ -29,7 +29,7 @@ def score(program, lines):
return math.pow(result, 1/len(program))
# find a sequence of edits that fixes [code]
-def fix(name, code, edits, timeout=30, debug=False):
+def fix(name, code, edits, aux_code='', timeout=30, debug=False):
todo = PQueue() # priority queue of candidate solutions
done = set() # set of already-analyzed solutions
@@ -72,7 +72,7 @@ def fix(name, code, edits, timeout=30, debug=False):
# if the code is correct, we are done
try:
- if test(name, code):
+ if test(name, code + '\n' + aux_code):
return code, path, total_time, n_tested
except:
pass