diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-02-09 20:38:38 +0100 |
---|---|---|
committer | Aleš Smodiš <aless@guru.si> | 2015-08-11 14:26:02 +0200 |
commit | 12c1e264dbb8ec979c17da362ff120a3fa87039c (patch) | |
tree | 7f83c9dd96397ad7b505cc22f6d7ba79ed8580da /monkey | |
parent | 089dc41954067ec351ae398214091aff269c8d67 (diff) |
Ignore edits after the first correct version
Diffstat (limited to 'monkey')
-rw-r--r-- | monkey/edits.py | 7 | ||||
-rwxr-xr-x | monkey/monkey.py | 1 |
2 files changed, 8 insertions, 0 deletions
diff --git a/monkey/edits.py b/monkey/edits.py index bf6560d..8747a6e 100644 --- a/monkey/edits.py +++ b/monkey/edits.py @@ -24,6 +24,7 @@ def edit_graph(actions, debug=False): leaves = {0: nodes[0]} # Current leaf node for each line. rank = 1 # Rank (order / y-position) for the next node. code_next = '' # Program code after applying the current action. + done = False # Set to True on first correct version. # Ensure there is a separate action for each inserted/removed character. expand(actions) @@ -33,11 +34,17 @@ def edit_graph(actions, debug=False): if action.type == 'test': submissions.add(code) + if action.total == action.passed: + done = True elif action.type == 'solve' or action.type == 'solve_all': queries.add(action.query) elif action.type == 'insert' or action.type == 'remove': + # Ignore edits after the first correct version. + if done: + continue + # Number of the changed line. line = code[:action.offset].count('\n') # Current leaf node for this line. diff --git a/monkey/monkey.py b/monkey/monkey.py index 0e622bf..0a934bc 100755 --- a/monkey/monkey.py +++ b/monkey/monkey.py @@ -109,6 +109,7 @@ def fix(name, code, edits, program_lines, aux_code='', timeout=30, debug=False): new_steps = [] i = 0 while i < len(steps): + # Check for successive edits on the same line. if i < len(steps)-1 and \ steps[i][0] in ('add_rule', 'add_subgoal', 'change_line') and \ steps[i+1][0] == 'change_line' and \ |