summaryrefslogtreecommitdiff
path: root/monkey/edits.py
diff options
context:
space:
mode:
authorTimotej Lazar <timotej.lazar@araneo.org>2015-02-09 20:38:38 +0100
committerAleš Smodiš <aless@guru.si>2015-08-11 14:26:02 +0200
commit12c1e264dbb8ec979c17da362ff120a3fa87039c (patch)
tree7f83c9dd96397ad7b505cc22f6d7ba79ed8580da /monkey/edits.py
parent089dc41954067ec351ae398214091aff269c8d67 (diff)
Ignore edits after the first correct version
Diffstat (limited to 'monkey/edits.py')
-rw-r--r--monkey/edits.py7
1 files changed, 7 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.