drakongen 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (157) hide show
  1. package/.vscode/launch.json +18 -0
  2. package/LICENSE +24 -0
  3. package/README.md +80 -0
  4. package/browser/drakongen.js +1303 -0
  5. package/browsertest.html +84 -0
  6. package/buildbrowser +4 -0
  7. package/buildexamples.js +61 -0
  8. package/examples/00.Empty.drakon +1 -0
  9. package/examples/00.Empty.txt +5 -0
  10. package/examples/01. /320/221/320/265/320/273/321/213/320/270/314/206.drakon" +13 -0
  11. package/examples/01. /320/221/320/265/320/273/321/213/320/271.json" +16 -0
  12. package/examples/01. /320/221/320/265/320/273/321/213/320/271.txt" +4 -0
  13. package/examples/02. /320/247/320/265/314/210/321/200/320/275/321/213/320/270/314/206.drakon" +28 -0
  14. package/examples/02. /320/247/321/221/321/200/320/275/321/213/320/271.json" +31 -0
  15. package/examples/02. /320/247/321/221/321/200/320/275/321/213/320/271.txt" +10 -0
  16. package/examples/03. /320/241/320/265/321/200/321/213/320/270/314/206.drakon" +20 -0
  17. package/examples/03. /320/241/320/265/321/200/321/213/320/271.json" +23 -0
  18. package/examples/03. /320/241/320/265/321/200/321/213/320/271.txt" +6 -0
  19. package/examples/04. /320/221/321/203/321/200/321/213/320/270/314/206.drakon" +25 -0
  20. package/examples/04. /320/221/321/203/321/200/321/213/320/271.json" +29 -0
  21. package/examples/04. /320/221/321/203/321/200/321/213/320/271.txt" +7 -0
  22. package/examples/05. /320/226/320/265/314/210/320/273/321/202/321/213/320/270/314/206.drakon" +25 -0
  23. package/examples/05. /320/226/321/221/320/273/321/202/321/213/320/271.json" +29 -0
  24. package/examples/05. /320/226/321/221/320/273/321/202/321/213/320/271.txt" +7 -0
  25. package/examples/06. /320/221/320/260/320/263/321/200/320/276/320/262/321/213/320/270/314/206.drakon" +30 -0
  26. package/examples/06. /320/221/320/260/320/263/321/200/320/276/320/262/321/213/320/271.json" +35 -0
  27. package/examples/06. /320/221/320/260/320/263/321/200/320/276/320/262/321/213/320/271.txt" +10 -0
  28. package/examples/07. /320/244/320/270/320/276/320/273/320/265/321/202/320/276/320/262/321/213/320/270/314/206.drakon" +42 -0
  29. package/examples/07. /320/244/320/270/320/276/320/273/320/265/321/202/320/276/320/262/321/213/320/271.json" +49 -0
  30. package/examples/07. /320/244/320/270/320/276/320/273/320/265/321/202/320/276/320/262/321/213/320/271.txt" +14 -0
  31. package/examples/08. /320/221/320/270/321/200/321/216/320/267/320/276/320/262/321/213/320/270/314/206.drakon" +27 -0
  32. package/examples/08. /320/221/320/270/321/200/321/216/320/267/320/276/320/262/321/213/320/271.json" +27 -0
  33. package/examples/08. /320/221/320/270/321/200/321/216/320/267/320/276/320/262/321/213/320/271.txt" +6 -0
  34. package/examples/09. /320/236/321/200/320/260/320/275/320/266/320/265/320/262/321/213/320/270/314/206.drakon" +37 -0
  35. package/examples/09. /320/236/321/200/320/260/320/275/320/266/320/265/320/262/321/213/320/271.json" +39 -0
  36. package/examples/09. /320/236/321/200/320/260/320/275/320/266/320/265/320/262/321/213/320/271.txt" +10 -0
  37. package/examples/10. /320/240/320/276/320/267/320/276/320/262/321/213/320/270/314/206.drakon" +42 -0
  38. package/examples/10. /320/240/320/276/320/267/320/276/320/262/321/213/320/271.json" +54 -0
  39. package/examples/10. /320/240/320/276/320/267/320/276/320/262/321/213/320/271.txt" +16 -0
  40. package/examples/11. /320/227/320/260/321/211/320/270/321/202/320/275/321/213/320/270/314/206.drakon" +37 -0
  41. package/examples/11. /320/227/320/260/321/211/320/270/321/202/320/275/321/213/320/271.json" +39 -0
  42. package/examples/11. /320/227/320/260/321/211/320/270/321/202/320/275/321/213/320/271.txt" +10 -0
  43. package/examples/12. /320/221/320/276/320/273/320/276/321/202/320/275/321/213/320/270/314/206.drakon" +44 -0
  44. package/examples/12. /320/221/320/276/320/273/320/276/321/202/320/275/321/213/320/271.json" +43 -0
  45. package/examples/12. /320/221/320/276/320/273/320/276/321/202/320/275/321/213/320/271.txt" +10 -0
  46. package/examples/13. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/270/314/206.drakon" +54 -0
  47. package/examples/13. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/271.json" +63 -0
  48. package/examples/13. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/271.txt" +18 -0
  49. package/examples/14. /320/227/320/276/320/273/320/276/321/202/320/276/320/270/314/206.drakon" +64 -0
  50. package/examples/14. /320/227/320/276/320/273/320/276/321/202/320/276/320/271.json" +73 -0
  51. package/examples/14. /320/227/320/276/320/273/320/276/321/202/320/276/320/271.txt" +22 -0
  52. package/examples/15. /320/241/320/270/320/275/320/270/320/270/314/206.drakon" +54 -0
  53. package/examples/15. /320/241/320/270/320/275/320/270/320/271.json" +87 -0
  54. package/examples/15. /320/241/320/270/320/275/320/270/320/271.txt" +26 -0
  55. package/examples/16. /320/223/320/276/320/273/321/203/320/261/320/276/320/270/314/206.drakon" +37 -0
  56. package/examples/16. /320/223/320/276/320/273/321/203/320/261/320/276/320/271.json" +48 -0
  57. package/examples/16. /320/223/320/276/320/273/321/203/320/261/320/276/320/271.txt" +13 -0
  58. package/examples/17. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/270/314/206.drakon" +39 -0
  59. package/examples/17. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/271.json" +41 -0
  60. package/examples/17. /320/241/320/260/320/273/320/260/321/202/320/276/320/262/321/213/320/271.txt" +10 -0
  61. package/examples/18. /320/241/321/202/320/260/320/273/321/214/320/275/320/276/320/270/314/206.drakon" +49 -0
  62. package/examples/18. /320/241/321/202/320/260/320/273/321/214/320/275/320/276/320/271.json" +67 -0
  63. package/examples/18. /320/241/321/202/320/260/320/273/321/214/320/275/320/276/320/271.txt" +19 -0
  64. package/examples/19. Lilla.drakon +39 -0
  65. package/examples/19. Lilla.json +45 -0
  66. package/examples/19. Lilla.txt +11 -0
  67. package/examples/Adaptive design.drakon +116 -0
  68. package/examples/Adaptive design.json +153 -0
  69. package/examples/Adaptive design.txt +47 -0
  70. package/examples/And test.drakon +46 -0
  71. package/examples/And test.json +46 -0
  72. package/examples/And test.txt +10 -0
  73. package/examples/Arrow - double exit.drakon +41 -0
  74. package/examples/Arrow - double exit.json +62 -0
  75. package/examples/Arrow - double exit.txt +14 -0
  76. package/examples/Complex arrow.drakon +93 -0
  77. package/examples/Complex arrow.json +162 -0
  78. package/examples/Complex arrow.txt +43 -0
  79. package/examples/DoubleArrow.drakon +53 -0
  80. package/examples/DoubleArrow.json +86 -0
  81. package/examples/DoubleArrow.txt +18 -0
  82. package/examples/Find pointing nodes.drakon +104 -0
  83. package/examples/Find pointing nodes.json +137 -0
  84. package/examples/Find pointing nodes.txt +29 -0
  85. package/examples/How to tune PID on a quadcopter.drakon +488 -0
  86. package/examples/How to tune PID on a quadcopter.json +734 -0
  87. package/examples/How to tune PID on a quadcopter.txt +169 -0
  88. package/examples/Or test.drakon +47 -0
  89. package/examples/Or test.json +46 -0
  90. package/examples/Or test.txt +10 -0
  91. package/examples/Silhouette test 1.drakon +47 -0
  92. package/examples/Silhouette test 1.json +82 -0
  93. package/examples/Silhouette test 1.txt +24 -0
  94. package/examples/Work out action-check.drakon +30 -0
  95. package/examples/Work out action-check.json +45 -0
  96. package/examples/Work out action-check.txt +9 -0
  97. package/examples/Workout foreach.drakon +63 -0
  98. package/examples/Workout foreach.json +62 -0
  99. package/examples/Workout foreach.txt +14 -0
  100. package/examples/ar01.drakon +25 -0
  101. package/examples/ar01.json +40 -0
  102. package/examples/ar01.txt +7 -0
  103. package/examples/ar02.drakon +30 -0
  104. package/examples/ar02.json +45 -0
  105. package/examples/ar02.txt +10 -0
  106. package/examples/ar03.drakon +32 -0
  107. package/examples/ar03.json +44 -0
  108. package/examples/ar03.txt +7 -0
  109. package/examples/ar04.drakon +37 -0
  110. package/examples/ar04.json +49 -0
  111. package/examples/ar04.txt +10 -0
  112. package/examples/ar05.drakon +37 -0
  113. package/examples/ar05.json +59 -0
  114. package/examples/ar05.txt +11 -0
  115. package/examples/ar06.drakon +40 -0
  116. package/examples/ar06.json +70 -0
  117. package/examples/ar06.txt +13 -0
  118. package/examples/ar07.drakon +40 -0
  119. package/examples/ar07.json +70 -0
  120. package/examples/ar07.txt +13 -0
  121. package/examples/ar08.drakon +47 -0
  122. package/examples/ar08.json +81 -0
  123. package/examples/ar08.txt +16 -0
  124. package/examples/ar09.drakon +52 -0
  125. package/examples/ar09.json +87 -0
  126. package/examples/ar09.txt +17 -0
  127. package/examples/ar10.drakon +52 -0
  128. package/examples/ar10.json +88 -0
  129. package/examples/ar10.txt +18 -0
  130. package/examples/ar11.drakon +47 -0
  131. package/examples/ar11.json +82 -0
  132. package/examples/ar11.txt +17 -0
  133. package/examples/ar12.drakon +37 -0
  134. package/examples/ar12.json +49 -0
  135. package/examples/ar12.txt +10 -0
  136. package/examples/getToken.drakon +76 -0
  137. package/examples/getToken.json +88 -0
  138. package/examples/getToken.txt +41 -0
  139. package/examples/tmp.drakon +49 -0
  140. package/examples/tmp.json +82 -0
  141. package/examples/tmp.txt +37 -0
  142. package/package.json +21 -0
  143. package/prompts/drakonToPrompt.txt +139 -0
  144. package/prompts/index.txt +17 -0
  145. package/prompts/printPseudo.txt +116 -0
  146. package/src/browserTools.js +39 -0
  147. package/src/drakonToPromptStruct.js +44 -0
  148. package/src/drakonToStruct.js +416 -0
  149. package/src/drakongen.js +16 -0
  150. package/src/index.js +17 -0
  151. package/src/main.js +157 -0
  152. package/src/nodeTools.js +38 -0
  153. package/src/printPseudo.js +167 -0
  154. package/src/structFlow.js +382 -0
  155. package/src/technicalTree.js +84 -0
  156. package/src/tools.js +36 -0
  157. package/src/translate.js +108 -0
@@ -0,0 +1,162 @@
1
+ {
2
+ "name": "Complex arrow",
3
+ "params": "",
4
+ "branches": [
5
+ {
6
+ "branchId": 0,
7
+ "start": "3",
8
+ "body": [
9
+ {
10
+ "id": "3",
11
+ "type": "action",
12
+ "content": "<p>AAAAAA</p>"
13
+ },
14
+ {
15
+ "id": "15",
16
+ "type": "loop",
17
+ "content": "",
18
+ "body": [
19
+ {
20
+ "id": "4",
21
+ "type": "action",
22
+ "content": "<p>BBBBB</p>"
23
+ },
24
+ {
25
+ "type": "question",
26
+ "id": "5",
27
+ "content": "<p>CCCCC</p>",
28
+ "yes": [
29
+ {
30
+ "type": "question",
31
+ "id": "8",
32
+ "content": "<p>FFFFFF</p>",
33
+ "yes": [],
34
+ "no": [
35
+ {
36
+ "id": "10",
37
+ "type": "loop",
38
+ "content": "<p>For each GGGGG</p>",
39
+ "body": [
40
+ {
41
+ "id": "11",
42
+ "type": "action",
43
+ "content": "<p>HHHHH</p>"
44
+ },
45
+ {
46
+ "type": "question",
47
+ "id": "12",
48
+ "content": "<p>IIIIII</p>",
49
+ "yes": [
50
+ {
51
+ "id": "9",
52
+ "type": "loopend",
53
+ "start": "10"
54
+ }
55
+ ],
56
+ "no": [
57
+ {
58
+ "type": "break"
59
+ }
60
+ ]
61
+ }
62
+ ]
63
+ }
64
+ ]
65
+ },
66
+ {
67
+ "type": "break"
68
+ }
69
+ ],
70
+ "no": [
71
+ {
72
+ "id": "6",
73
+ "type": "action",
74
+ "content": "<p>DDDDDD</p>"
75
+ },
76
+ {
77
+ "type": "question",
78
+ "id": "7",
79
+ "content": "<p>EEEEEE</p>",
80
+ "yes": [
81
+ {
82
+ "id": "10",
83
+ "type": "loop",
84
+ "content": "<p>For each GGGGG</p>",
85
+ "body": [
86
+ {
87
+ "id": "11",
88
+ "type": "action",
89
+ "content": "<p>HHHHH</p>"
90
+ },
91
+ {
92
+ "type": "question",
93
+ "id": "12",
94
+ "content": "<p>IIIIII</p>",
95
+ "yes": [
96
+ {
97
+ "id": "9",
98
+ "type": "loopend",
99
+ "start": "10"
100
+ }
101
+ ],
102
+ "no": [
103
+ {
104
+ "type": "break"
105
+ }
106
+ ]
107
+ }
108
+ ]
109
+ },
110
+ {
111
+ "type": "break"
112
+ }
113
+ ],
114
+ "no": [
115
+ {
116
+ "id": "14",
117
+ "type": "loop",
118
+ "content": "",
119
+ "body": [
120
+ {
121
+ "type": "question",
122
+ "id": "13",
123
+ "content": "<p>JJJJ</p>",
124
+ "yes": [
125
+ {
126
+ "type": "break"
127
+ }
128
+ ],
129
+ "no": [
130
+ {
131
+ "id": "arrow-stub-14",
132
+ "type": "loopend",
133
+ "start": "14"
134
+ }
135
+ ]
136
+ }
137
+ ]
138
+ },
139
+ {
140
+ "id": "arrow-stub-15",
141
+ "type": "loopend",
142
+ "start": "15"
143
+ }
144
+ ]
145
+ }
146
+ ]
147
+ }
148
+ ]
149
+ },
150
+ {
151
+ "id": "16",
152
+ "type": "action",
153
+ "content": "<p>KKKK</p>"
154
+ },
155
+ {
156
+ "id": "1",
157
+ "type": "end"
158
+ }
159
+ ]
160
+ }
161
+ ]
162
+ }
@@ -0,0 +1,43 @@
1
+ Parameters:
2
+ one - first
3
+ two - second
4
+
5
+ Procedure "Complex arrow"
6
+
7
+ Algorithm:
8
+ AAAAAA
9
+
10
+ Loop forever
11
+ BBBBB
12
+
13
+ If CCCCC
14
+ If not (FFFFFF)
15
+ For each GGGGG
16
+ HHHHH
17
+
18
+ If not (IIIIII)
19
+ break
20
+ break
21
+ Else
22
+ DDDDDD
23
+
24
+ If EEEEEE
25
+ For each GGGGG
26
+ HHHHH
27
+
28
+ If not (IIIIII)
29
+ break
30
+ break
31
+ Else
32
+ Loop forever
33
+ If JJJJ
34
+ break
35
+ KKKK
36
+
37
+ End of procedure
38
+
39
+ Hello
40
+
41
+ 1. Bar
42
+ 2. What is it?
43
+
@@ -0,0 +1,53 @@
1
+ {
2
+ "items": {
3
+ "1": {
4
+ "type": "end"
5
+ },
6
+ "2": {
7
+ "type": "branch",
8
+ "branchId": 0,
9
+ "one": "15"
10
+ },
11
+ "5": {
12
+ "type": "question",
13
+ "content": "<p>CCCCC</p>",
14
+ "one": "16",
15
+ "two": "7",
16
+ "flag1": 1
17
+ },
18
+ "7": {
19
+ "type": "question",
20
+ "content": "<p>EEEEEE</p>",
21
+ "one": "17",
22
+ "two": "14",
23
+ "flag1": 1
24
+ },
25
+ "13": {
26
+ "type": "question",
27
+ "content": "<p>JJJJ</p>",
28
+ "one": "15",
29
+ "two": "14",
30
+ "flag1": 1
31
+ },
32
+ "14": {
33
+ "type": "arrow-loop",
34
+ "one": "13"
35
+ },
36
+ "15": {
37
+ "type": "arrow-loop",
38
+ "one": "5"
39
+ },
40
+ "16": {
41
+ "type": "action",
42
+ "content": "<p>KKKK</p>",
43
+ "one": "1"
44
+ },
45
+ "17": {
46
+ "type": "action",
47
+ "content": "<p>qqq</p>",
48
+ "one": "16"
49
+ }
50
+ },
51
+ "type": "drakon",
52
+ "id": "tmp.drakon"
53
+ }
@@ -0,0 +1,86 @@
1
+ {
2
+ "name": "DoubleArrow",
3
+ "params": "",
4
+ "branches": [
5
+ {
6
+ "branchId": 0,
7
+ "start": "15",
8
+ "body": [
9
+ {
10
+ "id": "15",
11
+ "type": "loop",
12
+ "content": "",
13
+ "body": [
14
+ {
15
+ "type": "question",
16
+ "id": "5",
17
+ "content": "<p>CCCCC</p>",
18
+ "yes": [
19
+ {
20
+ "type": "break"
21
+ }
22
+ ],
23
+ "no": [
24
+ {
25
+ "type": "question",
26
+ "id": "7",
27
+ "content": "<p>EEEEEE</p>",
28
+ "yes": [
29
+ {
30
+ "id": "17",
31
+ "type": "action",
32
+ "content": "<p>qqq</p>"
33
+ },
34
+ {
35
+ "type": "break"
36
+ }
37
+ ],
38
+ "no": [
39
+ {
40
+ "id": "14",
41
+ "type": "loop",
42
+ "content": "",
43
+ "body": [
44
+ {
45
+ "type": "question",
46
+ "id": "13",
47
+ "content": "<p>JJJJ</p>",
48
+ "yes": [
49
+ {
50
+ "type": "break"
51
+ }
52
+ ],
53
+ "no": [
54
+ {
55
+ "id": "arrow-stub-14",
56
+ "type": "loopend",
57
+ "start": "14"
58
+ }
59
+ ]
60
+ }
61
+ ]
62
+ },
63
+ {
64
+ "id": "arrow-stub-15",
65
+ "type": "loopend",
66
+ "start": "15"
67
+ }
68
+ ]
69
+ }
70
+ ]
71
+ }
72
+ ]
73
+ },
74
+ {
75
+ "id": "16",
76
+ "type": "action",
77
+ "content": "<p>KKKK</p>"
78
+ },
79
+ {
80
+ "id": "1",
81
+ "type": "end"
82
+ }
83
+ ]
84
+ }
85
+ ]
86
+ }
@@ -0,0 +1,18 @@
1
+ Procedure "DoubleArrow"
2
+
3
+ Algorithm:
4
+ Loop forever
5
+ If CCCCC
6
+ break
7
+ Else
8
+ If EEEEEE
9
+ qqq
10
+
11
+ break
12
+ Else
13
+ Loop forever
14
+ If JJJJ
15
+ break
16
+ KKKK
17
+
18
+ End of procedure
@@ -0,0 +1,104 @@
1
+ {
2
+ "items": {
3
+ "1": {
4
+ "type": "end"
5
+ },
6
+ "2": {
7
+ "type": "branch",
8
+ "branchId": 0,
9
+ "one": "3"
10
+ },
11
+ "3": {
12
+ "type": "action",
13
+ "content": "<p>Start with an empty list</p>",
14
+ "one": "11"
15
+ },
16
+ "4": {
17
+ "type": "loopend",
18
+ "one": "6"
19
+ },
20
+ "5": {
21
+ "type": "loopbegin",
22
+ "one": "7",
23
+ "content": "<p>For each id in node.prev</p>"
24
+ },
25
+ "6": {
26
+ "type": "action",
27
+ "content": "<p>Return the list</p>",
28
+ "one": "1"
29
+ },
30
+ "7": {
31
+ "type": "action",
32
+ "content": "<p>get the prev node by id</p>",
33
+ "one": "12"
34
+ },
35
+ "8": {
36
+ "type": "question",
37
+ "content": "<p>The parent loop of prev node == parent loop</p>",
38
+ "one": "4",
39
+ "two": "9",
40
+ "flag1": 0
41
+ },
42
+ "9": {
43
+ "type": "action",
44
+ "content": "<p>add prev node to list</p>",
45
+ "one": "10"
46
+ },
47
+ "10": {
48
+ "type": "question",
49
+ "content": "<p>list length &gt; 10</p>",
50
+ "one": "4",
51
+ "two": "13",
52
+ "flag1": 0
53
+ },
54
+ "11": {
55
+ "type": "question",
56
+ "content": "<p>node.prev</p>",
57
+ "one": "5",
58
+ "two": "6",
59
+ "flag1": 1
60
+ },
61
+ "12": {
62
+ "type": "question",
63
+ "content": "<p>prev node is poisoned</p>",
64
+ "one": "8",
65
+ "two": "6",
66
+ "flag1": 0
67
+ },
68
+ "13": {
69
+ "type": "question",
70
+ "content": "<p>extra check</p>",
71
+ "one": "14",
72
+ "two": "16",
73
+ "flag1": 1
74
+ },
75
+ "14": {
76
+ "type": "action",
77
+ "content": "<p>fine</p>",
78
+ "one": "6"
79
+ },
80
+ "15": {
81
+ "type": "loopend",
82
+ "one": "6"
83
+ },
84
+ "16": {
85
+ "type": "loopbegin",
86
+ "one": "17",
87
+ "content": "<p>for each hair</p>"
88
+ },
89
+ "17": {
90
+ "type": "action",
91
+ "content": "<p>raise the hair</p>",
92
+ "one": "18"
93
+ },
94
+ "18": {
95
+ "type": "question",
96
+ "content": "<p>raised?</p>",
97
+ "one": "15",
98
+ "two": "6",
99
+ "flag1": 1
100
+ }
101
+ },
102
+ "type": "drakon",
103
+ "id": "Find pointing nodes.drakon"
104
+ }
@@ -0,0 +1,137 @@
1
+ {
2
+ "name": "Find pointing nodes",
3
+ "params": "",
4
+ "branches": [
5
+ {
6
+ "branchId": 0,
7
+ "start": "3",
8
+ "body": [
9
+ {
10
+ "id": "3",
11
+ "type": "action",
12
+ "content": "<p>Start with an empty list</p>"
13
+ },
14
+ {
15
+ "type": "question",
16
+ "id": "11",
17
+ "content": "<p>node.prev</p>",
18
+ "yes": [
19
+ {
20
+ "id": "5",
21
+ "type": "loop",
22
+ "content": "<p>For each id in node.prev</p>",
23
+ "body": [
24
+ {
25
+ "id": "7",
26
+ "type": "action",
27
+ "content": "<p>get the prev node by id</p>"
28
+ },
29
+ {
30
+ "type": "question",
31
+ "id": "12",
32
+ "content": "<p>prev node is poisoned</p>",
33
+ "yes": [
34
+ {
35
+ "type": "break"
36
+ }
37
+ ],
38
+ "no": [
39
+ {
40
+ "type": "question",
41
+ "id": "8",
42
+ "content": "<p>The parent loop of prev node == parent loop</p>",
43
+ "yes": [
44
+ {
45
+ "id": "9",
46
+ "type": "action",
47
+ "content": "<p>add prev node to list</p>"
48
+ },
49
+ {
50
+ "type": "question",
51
+ "id": "10",
52
+ "content": "<p>list length &gt; 10</p>",
53
+ "yes": [
54
+ {
55
+ "type": "question",
56
+ "id": "13",
57
+ "content": "<p>extra check</p>",
58
+ "yes": [
59
+ {
60
+ "id": "14",
61
+ "type": "action",
62
+ "content": "<p>fine</p>"
63
+ }
64
+ ],
65
+ "no": [
66
+ {
67
+ "id": "16",
68
+ "type": "loop",
69
+ "content": "<p>for each hair</p>",
70
+ "body": [
71
+ {
72
+ "id": "17",
73
+ "type": "action",
74
+ "content": "<p>raise the hair</p>"
75
+ },
76
+ {
77
+ "type": "question",
78
+ "id": "18",
79
+ "content": "<p>raised?</p>",
80
+ "yes": [
81
+ {
82
+ "id": "15",
83
+ "type": "loopend",
84
+ "start": "16"
85
+ }
86
+ ],
87
+ "no": [
88
+ {
89
+ "type": "break"
90
+ }
91
+ ]
92
+ }
93
+ ]
94
+ }
95
+ ]
96
+ },
97
+ {
98
+ "type": "break"
99
+ }
100
+ ],
101
+ "no": [
102
+ {
103
+ "id": "4",
104
+ "type": "loopend",
105
+ "start": "5"
106
+ }
107
+ ]
108
+ }
109
+ ],
110
+ "no": [
111
+ {
112
+ "id": "4",
113
+ "type": "loopend",
114
+ "start": "5"
115
+ }
116
+ ]
117
+ }
118
+ ]
119
+ }
120
+ ]
121
+ }
122
+ ],
123
+ "no": []
124
+ },
125
+ {
126
+ "id": "6",
127
+ "type": "action",
128
+ "content": "<p>Return the list</p>"
129
+ },
130
+ {
131
+ "id": "1",
132
+ "type": "end"
133
+ }
134
+ ]
135
+ }
136
+ ]
137
+ }
@@ -0,0 +1,29 @@
1
+ Procedure "Find pointing nodes"
2
+
3
+ Algorithm:
4
+ Start with an empty list
5
+
6
+ If node.prev
7
+ For each id in node.prev
8
+ get the prev node by id
9
+
10
+ If prev node is poisoned
11
+ break
12
+ Else
13
+ If The parent loop of prev node == parent loop
14
+ add prev node to list
15
+
16
+ If list length > 10
17
+ If extra check
18
+ fine
19
+
20
+ Else
21
+ for each hair
22
+ raise the hair
23
+
24
+ If not (raised?)
25
+ break
26
+ break
27
+ Return the list
28
+
29
+ End of procedure