-
Notifications
You must be signed in to change notification settings - Fork 0
/
embedding-demo.js
87 lines (74 loc) · 20.1 KB
/
embedding-demo.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
// var TRACE = {"code": "x = [1, 2, 3]\ny = [4, 5, 6]\nz = y\ny = x\nx = z\n\nx = [1, 2, 3] # a different [1, 2, 3] list!\ny = x\nx.append(4)\ny.append(5)\nz = [1, 2, 3, 4, 5] # a different list!\nx.append(6)\ny.append(7)\ny = \"hello\"\n\n\ndef foo(lst):\n lst.append(\"hello\")\n bar(lst)\n\ndef bar(myLst):\n print(myLst)\n\nfoo(x)\nfoo(z)\n", "trace": [{"ordered_globals": [], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {}, "heap": {}, "line": 1, "event": "step_line"}, {"ordered_globals": ["x"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"x": ["REF", 1]}, "heap": {"1": ["LIST", 1, 2, 3]}, "line": 2, "event": "step_line"}, {"ordered_globals": ["x", "y"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 2], "x": ["REF", 1]}, "heap": {"1": ["LIST", 1, 2, 3], "2": ["LIST", 4, 5, 6]}, "line": 3, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 2], "x": ["REF", 1], "z": ["REF", 2]}, "heap": {"1": ["LIST", 1, 2, 3], "2": ["LIST", 4, 5, 6]}, "line": 4, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 1], "x": ["REF", 1], "z": ["REF", 2]}, "heap": {"1": ["LIST", 1, 2, 3], "2": ["LIST", 4, 5, 6]}, "line": 5, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 1], "x": ["REF", 2], "z": ["REF", 2]}, "heap": {"1": ["LIST", 1, 2, 3], "2": ["LIST", 4, 5, 6]}, "line": 7, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 1], "x": ["REF", 3], "z": ["REF", 2]}, "heap": {"1": ["LIST", 1, 2, 3], "2": ["LIST", 4, 5, 6], "3": ["LIST", 1, 2, 3]}, "line": 8, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 2]}, "heap": {"2": ["LIST", 4, 5, 6], "3": ["LIST", 1, 2, 3]}, "line": 9, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 2]}, "heap": {"2": ["LIST", 4, 5, 6], "3": ["LIST", 1, 2, 3, 4]}, "line": 10, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 2]}, "heap": {"2": ["LIST", 4, 5, 6], "3": ["LIST", 1, 2, 3, 4, 5]}, "line": 11, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5], "4": ["LIST", 1, 2, 3, 4, 5]}, "line": 12, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6], "4": ["LIST", 1, 2, 3, 4, 5]}, "line": 13, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": ["REF", 3], "x": ["REF", 3], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5]}, "line": 14, "event": "step_line"}, {"ordered_globals": ["x", "y", "z"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": "hello", "x": ["REF", 3], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5]}, "line": 17, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null]}, "line": 21, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "<module>", "stack_to_render": [], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 24, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "foo", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 17, "event": "call"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "foo", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 18, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "foo", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 19, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "bar", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}, {"frame_id": 2, "encoded_locals": {"myLst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f2", "ordered_varnames": ["myLst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 21, "event": "call"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "", "func_name": "bar", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}, {"frame_id": 2, "encoded_locals": {"myLst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f2", "ordered_varnames": ["myLst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 22, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "bar", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"lst": ["REF", 3]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst"]}, {"frame_id": 2, "encoded_locals": {"__return__": null, "myLst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f2", "ordered_varnames": ["myLst", "__return__"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 22, "event": "return"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "foo", "stack_to_render": [{"frame_id": 1, "encoded_locals": {"__return__": null, "lst": ["REF", 3]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f1", "ordered_varnames": ["lst", "__return__"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 19, "event": "return"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "<module>", "stack_to_render": [], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 25, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "foo", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 17, "event": "call"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "foo", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 18, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "foo", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 19, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "bar", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}, {"frame_id": 4, "encoded_locals": {"myLst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f4", "ordered_varnames": ["myLst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 21, "event": "call"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n", "func_name": "bar", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}, {"frame_id": 4, "encoded_locals": {"myLst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f4", "ordered_varnames": ["myLst"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 22, "event": "step_line"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n[1, 2, 3, 4, 5, 'hello']\n", "func_name": "bar", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"lst": ["REF", 4]}, "is_highlighted": false, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst"]}, {"frame_id": 4, "encoded_locals": {"__return__": null, "myLst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "bar", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "bar_f4", "ordered_varnames": ["myLst", "__return__"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 22, "event": "return"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n[1, 2, 3, 4, 5, 'hello']\n", "func_name": "foo", "stack_to_render": [{"frame_id": 3, "encoded_locals": {"__return__": null, "lst": ["REF", 4]}, "is_highlighted": true, "is_parent": false, "func_name": "foo", "is_zombie": false, "parent_frame_id_list": [], "unique_hash": "foo_f3", "ordered_varnames": ["lst", "__return__"]}], "globals": {"y": "hello", "x": ["REF", 3], "foo": ["REF", 5], "bar": ["REF", 6], "z": ["REF", 4]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 19, "event": "return"}, {"ordered_globals": ["x", "y", "z", "foo", "bar"], "stdout": "[1, 2, 3, 4, 5, 6, 7, 'hello']\n[1, 2, 3, 4, 5, 'hello']\n", "func_name": "<module>", "stack_to_render": [], "globals": {"y": "hello", "x": ["REF", 3], "z": ["REF", 4], "bar": ["REF", 6], "foo": ["REF", 5]}, "heap": {"3": ["LIST", 1, 2, 3, 4, 5, 6, 7, "hello"], "4": ["LIST", 1, 2, 3, 4, 5, "hello"], "5": ["FUNCTION", "foo(lst)", null], "6": ["FUNCTION", "bar(myLst)", null]}, "line": 25, "event": "return"}]};
$(document).ready(function() {
if (getUrlParameter('session') != '') {
var session = getUrlParameter('session');
$.ajax({
dataType: "jsonp",
type: "POST",
url: 'http://45.56.123.166:5000/get_session',
data: {session: session},
success: function(d){
var params = JSON.parse(d.params);
var code = JSON.parse(d.code);
console.log(code);
var myVis = new ExecutionVisualizer('happyDiv', code, params);
// alert(getUrlParameter('jumpToStep'));
if(getUrlParameter('jumpToRandomStep') == 'true') myVis.jumpToRandomStep();
else if(getUrlParameter('jumpToStep') != '') myVis.jumpToStep(parseInt(getUrlParameter('jumpToStep')));
}
});
}
// var params = {allowEditAnnotations: true};
// console.log("save TRACE into database:", JSON.stringify(TRACE));
// console.log("save params into database:", JSON.stringify(params));
// var myVis = new ExecutionVisualizer('happyDiv', TRACE, params);
// var bradsVisualizer = new ExecutionVisualizer('bradsDiv', bradstrace,
// {embeddedMode: true,
// heightChangeCallback: redrawAllVisualizerArrows,
// editCodeBaseURL: 'http://pythontutor.com/visualize.html'});
// // Render listSumTrace inside of listSumDiv
// var listSumVisualizer = new ExecutionVisualizer('listSumDiv', listSumTrace,
// {embeddedMode: true,
// heightChangeCallback: redrawAllVisualizerArrows,
// editCodeBaseURL: 'http://pythontutor.com/visualize.html'});
// // The "startingInstruction: 15" optional parameter means to jump to step 15
// // in the visualization when it loads. (The HTML webpage will actually display
// // "Step 16 of 64" since indices are zero-indexed.)
// //
// // verticalStack means to stack the code and visualizations vertically atop one another
// // (rather than side-by-side)
// var hanoiVisualizer = new ExecutionVisualizer('hanoiDiv', hanoiTrace,
// {embeddedMode: true,
// startingInstruction: 15,
// verticalStack: true,
// heightChangeCallback: redrawAllVisualizerArrows,
// editCodeBaseURL: 'http://pythontutor.com/visualize.html'});
// // "embeddedMode: false" displays the full visualizer widget with the "Program Output" pane
// // "jumpToEnd: true" means to jump to the end of execution upon loading.
// var happyVisualizer = new ExecutionVisualizer('happyDiv', happyTrace,
// {embeddedMode: false,
// jumpToEnd: true,
// codeDivWidth: 600,
// codeDivHeight: 300,
// allowEditAnnotations: true,
// // no need for heightChangeCallback since
// // this is the "bottom-most" visualizer,
// // so no arrows appear below it
// editCodeBaseURL: 'http://pythontutor.com/visualize.html'});
function redrawAllVisualizerArrows() {
// if (listSumVisualizer) listSumVisualizer.redrawConnectors();
// if (hanoiVisualizer) hanoiVisualizer.redrawConnectors();
// if (happyVisualizer) happyVisualizer.redrawConnectors();
}
// Call redrawConnectors() on all visualizers whenever the window is resized,
// since HTML elements might have moved during a resize. The SVG arrows rendered
// by jsPlumb don't automatically get re-drawn in their new positions unless
// redrawConnectors() is called.
$(window).resize(redrawAllVisualizerArrows);
});
function getUrlParameter(name) {
name = name.replace(/[\[]/, "\\[").replace(/[\]]/, "\\]");
var regex = new RegExp("[\\?&]" + name + "=([^&#]*)"),
results = regex.exec(location.search);
return results === null ? "" : decodeURIComponent(results[1].replace(/\+/g, " "));
}