diff options
author | Timotej Lazar <timotej.lazar@araneo.org> | 2015-10-05 19:29:15 +0200 |
---|---|---|
committer | Timotej Lazar <timotej.lazar@araneo.org> | 2015-10-05 19:29:15 +0200 |
commit | 4586cb0e9d6cc862176314dcaa29edfea3c8eb4d (patch) | |
tree | bf6270ada1a3529444395a58f50fe08bc0f4c8ae | |
parent | 3f54d449c4ebad07ddf4e8018c5ee0f0a4b00cd5 (diff) |
Update actions
-rwxr-xr-x | monkey/action.py | 10 | ||||
-rw-r--r-- | readme.md | 33 |
2 files changed, 38 insertions, 5 deletions
diff --git a/monkey/action.py b/monkey/action.py index 121dced..bb046da 100755 --- a/monkey/action.py +++ b/monkey/action.py @@ -49,13 +49,13 @@ class Action: _packet_action_map = { 'ins': lambda packet, time, code: Action('insert', time, offset=packet['off'], text=packet['txt']), - 'rm': lambda packet, time, code: Action('remove', time, offset=packet['off'], text=code[packet['off']:packet['off']+packet['len']]), - 'slv': lambda packet, time, code: Action('solve', time, text=packet['qry']), - 'slva': lambda packet, time, code: Action('solve_all', time, text=packet['qry']), - 'nxt': lambda packet, time, code: Action('next', time), - 'stp': lambda packet, time, code: Action('stop', time), + 'rm': lambda packet, time, code: Action('remove', time, offset=packet['off'], text=packet['txt']), 'tst': lambda packet, time, code: Action('test', time, total=packet['tot'], passed=packet['pas']), 'hnt': lambda packet, time, code: Action('hint', time) + 'slva': lambda packet, time, code: Action('solve_all', time, text=packet['qry']), + 'prolog_query': lambda packet, time, code: Action('prolog_query', time, text=packet['qry']), + 'prolog_next': lambda packet, time, code: Action('next', time), + 'prolog_end': lambda packet, time, code: Action('stop', time), } # parse log from database into a list of actions, cleaning up some fluff. # ignore non-text actions (queries and tests) @@ -114,3 +114,36 @@ You can test stuff in a python interpreter: >>> prolog = session.get_prolog() >>> prolog.test(231, 96, 'sister(X,Y):- parent(P,X), parent(P,Y), female(X).') >>> prolog.hint(231, 96, 'sister(X,Y):- parent(P,X), parent(P,Y), female(X).') + +Traces +====== + +Actions and corresponding additional attributes are specified here. + +Generic: + - open(time) # when opening the problem page, time = Date.now() on client + - close() # when closing the problem page + - ins(off, txt) # offset, text + - rm(off, txt) # offset, text, was rm(off, len) + - plan() + - hint(feedback) # feedback = list of returned hint objects + - test(feedback) # feedback = list of returned hint objects + +Prolog: + - prolog_solve(query) # was slv(qry) + - prolog_next() # was nxt + - prolog_end() # was stp + +Python: + - python_run(program) + - python_stop() + - python_input(txt) + +Robot: + - robot_run(program) + - robot_stop() + +Obsolete actions: + - slva(query) # "solve all" from tuProlog + - hnt # hint button press + - tst(tot, pas) # test results (total / passed) |