├── LICENSE
├── README.md
├── chemlambda4.jpg
├── dynamic
├── 20_quine.html
├── 20_quine.mol
├── 9_quine.mol
├── README.md
├── ackermann_2_2.mol
├── check_1_mov2_alt.awk
├── check_1_mov2_rand.awk
├── firstpart.txt
├── lastpart.txt
├── moving_alt.sh
├── moving_random.sh
├── random_ackermann_2_2.html
├── yfrcombtreefo.html
└── yfrcombtreefo.mol
├── quines_periodics_and_walkers
├── 0_0_FI_FO_FI_FOE.mol
├── 10_quine_bubbles.mol
├── 16_quine_A_L_FI_FO.mol
├── 16_quine_A_L_FI_FO_duplicate.mol
├── 1_2_FI_FO_FI_FO.mol
├── 20_quine.mol
├── 28_quine.mol
├── 2_2_A_FO_FI_L.mol
├── 3_3_FI_FO_A_L_gives_16_bubble_quine.mol
├── 3_3_FI_FO_A_L_modified_20_bubble_quine.mol
├── 3_4_FI_FO_A_L.mol
├── 3bit.mol
├── 9_quine.mol
├── tame_turing_neuron.mol
├── walker.mol
├── walker_eating_bit.mol
├── walker_eating_lterm.mol
├── walker_eating_mulin.mol
├── walker_eating_prop.mol
├── walker_fifo.mol
├── walker_fifo_back_to_afoe.mol
├── walker_fifo_other_bit.mol
├── walker_fifo_step8.mol
└── walker_fifo_walker_afoe.mol
├── scripts_and_mol_files
├── 10_quine_bubbles.mol
├── 2neurons.mol
├── ackermann_2_2.mol
├── assembler.mol
├── bitbit.sh
├── check_1_foe.awk
├── convert.mol
├── conzipper.mol
├── double_s.mol
├── fineuron.mol
├── flipper.mol
├── foe_bubbles_04_11.awk
├── foe_bubbles_bit_exp.awk
├── foetape.mol
├── gen_check_1_foe.awk
├── gen_viral_foe_bubbles.sh
├── lfoafoe.mol
├── look.html
├── main_viral_foe_bubbles.sh
├── main_viral_foe_bubbles_inter.sh
├── molecule_with_tricks.js
├── petersen.mol
├── pred_2.mol
├── skk.mol
├── space_check_1_foe.awk
├── space_viral_foe_bubbles.sh
├── space_viral_foe_bubbles_inter.sh
├── switcher.mol
├── tape.mol
├── triple.mol
├── walker_eating_bit.mol
├── walker_eating_lterm.mol
├── walker_eating_other_bit.mol
├── walker_fifo.mol
├── walker_fifo_back_to_afoe.mol
├── walker_fifo_other_bit.mol
├── zlong.mol
└── zshort.mol
└── spiral_boole_bb_short.gif
/LICENSE:
--------------------------------------------------------------------------------
1 | GNU GENERAL PUBLIC LICENSE
2 | Version 2, June 1991
3 |
4 | Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
5 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
6 | Everyone is permitted to copy and distribute verbatim copies
7 | of this license document, but changing it is not allowed.
8 |
9 | Preamble
10 |
11 | The licenses for most software are designed to take away your
12 | freedom to share and change it. By contrast, the GNU General Public
13 | License is intended to guarantee your freedom to share and change free
14 | software--to make sure the software is free for all its users. This
15 | General Public License applies to most of the Free Software
16 | Foundation's software and to any other program whose authors commit to
17 | using it. (Some other Free Software Foundation software is covered by
18 | the GNU Lesser General Public License instead.) You can apply it to
19 | your programs, too.
20 |
21 | When we speak of free software, we are referring to freedom, not
22 | price. Our General Public Licenses are designed to make sure that you
23 | have the freedom to distribute copies of free software (and charge for
24 | this service if you wish), that you receive source code or can get it
25 | if you want it, that you can change the software or use pieces of it
26 | in new free programs; and that you know you can do these things.
27 |
28 | To protect your rights, we need to make restrictions that forbid
29 | anyone to deny you these rights or to ask you to surrender the rights.
30 | These restrictions translate to certain responsibilities for you if you
31 | distribute copies of the software, or if you modify it.
32 |
33 | For example, if you distribute copies of such a program, whether
34 | gratis or for a fee, you must give the recipients all the rights that
35 | you have. You must make sure that they, too, receive or can get the
36 | source code. And you must show them these terms so they know their
37 | rights.
38 |
39 | We protect your rights with two steps: (1) copyright the software, and
40 | (2) offer you this license which gives you legal permission to copy,
41 | distribute and/or modify the software.
42 |
43 | Also, for each author's protection and ours, we want to make certain
44 | that everyone understands that there is no warranty for this free
45 | software. If the software is modified by someone else and passed on, we
46 | want its recipients to know that what they have is not the original, so
47 | that any problems introduced by others will not reflect on the original
48 | authors' reputations.
49 |
50 | Finally, any free program is threatened constantly by software
51 | patents. We wish to avoid the danger that redistributors of a free
52 | program will individually obtain patent licenses, in effect making the
53 | program proprietary. To prevent this, we have made it clear that any
54 | patent must be licensed for everyone's free use or not licensed at all.
55 |
56 | The precise terms and conditions for copying, distribution and
57 | modification follow.
58 |
59 | GNU GENERAL PUBLIC LICENSE
60 | TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
61 |
62 | 0. This License applies to any program or other work which contains
63 | a notice placed by the copyright holder saying it may be distributed
64 | under the terms of this General Public License. The "Program", below,
65 | refers to any such program or work, and a "work based on the Program"
66 | means either the Program or any derivative work under copyright law:
67 | that is to say, a work containing the Program or a portion of it,
68 | either verbatim or with modifications and/or translated into another
69 | language. (Hereinafter, translation is included without limitation in
70 | the term "modification".) Each licensee is addressed as "you".
71 |
72 | Activities other than copying, distribution and modification are not
73 | covered by this License; they are outside its scope. The act of
74 | running the Program is not restricted, and the output from the Program
75 | is covered only if its contents constitute a work based on the
76 | Program (independent of having been made by running the Program).
77 | Whether that is true depends on what the Program does.
78 |
79 | 1. You may copy and distribute verbatim copies of the Program's
80 | source code as you receive it, in any medium, provided that you
81 | conspicuously and appropriately publish on each copy an appropriate
82 | copyright notice and disclaimer of warranty; keep intact all the
83 | notices that refer to this License and to the absence of any warranty;
84 | and give any other recipients of the Program a copy of this License
85 | along with the Program.
86 |
87 | You may charge a fee for the physical act of transferring a copy, and
88 | you may at your option offer warranty protection in exchange for a fee.
89 |
90 | 2. You may modify your copy or copies of the Program or any portion
91 | of it, thus forming a work based on the Program, and copy and
92 | distribute such modifications or work under the terms of Section 1
93 | above, provided that you also meet all of these conditions:
94 |
95 | a) You must cause the modified files to carry prominent notices
96 | stating that you changed the files and the date of any change.
97 |
98 | b) You must cause any work that you distribute or publish, that in
99 | whole or in part contains or is derived from the Program or any
100 | part thereof, to be licensed as a whole at no charge to all third
101 | parties under the terms of this License.
102 |
103 | c) If the modified program normally reads commands interactively
104 | when run, you must cause it, when started running for such
105 | interactive use in the most ordinary way, to print or display an
106 | announcement including an appropriate copyright notice and a
107 | notice that there is no warranty (or else, saying that you provide
108 | a warranty) and that users may redistribute the program under
109 | these conditions, and telling the user how to view a copy of this
110 | License. (Exception: if the Program itself is interactive but
111 | does not normally print such an announcement, your work based on
112 | the Program is not required to print an announcement.)
113 |
114 | These requirements apply to the modified work as a whole. If
115 | identifiable sections of that work are not derived from the Program,
116 | and can be reasonably considered independent and separate works in
117 | themselves, then this License, and its terms, do not apply to those
118 | sections when you distribute them as separate works. But when you
119 | distribute the same sections as part of a whole which is a work based
120 | on the Program, the distribution of the whole must be on the terms of
121 | this License, whose permissions for other licensees extend to the
122 | entire whole, and thus to each and every part regardless of who wrote it.
123 |
124 | Thus, it is not the intent of this section to claim rights or contest
125 | your rights to work written entirely by you; rather, the intent is to
126 | exercise the right to control the distribution of derivative or
127 | collective works based on the Program.
128 |
129 | In addition, mere aggregation of another work not based on the Program
130 | with the Program (or with a work based on the Program) on a volume of
131 | a storage or distribution medium does not bring the other work under
132 | the scope of this License.
133 |
134 | 3. You may copy and distribute the Program (or a work based on it,
135 | under Section 2) in object code or executable form under the terms of
136 | Sections 1 and 2 above provided that you also do one of the following:
137 |
138 | a) Accompany it with the complete corresponding machine-readable
139 | source code, which must be distributed under the terms of Sections
140 | 1 and 2 above on a medium customarily used for software interchange; or,
141 |
142 | b) Accompany it with a written offer, valid for at least three
143 | years, to give any third party, for a charge no more than your
144 | cost of physically performing source distribution, a complete
145 | machine-readable copy of the corresponding source code, to be
146 | distributed under the terms of Sections 1 and 2 above on a medium
147 | customarily used for software interchange; or,
148 |
149 | c) Accompany it with the information you received as to the offer
150 | to distribute corresponding source code. (This alternative is
151 | allowed only for noncommercial distribution and only if you
152 | received the program in object code or executable form with such
153 | an offer, in accord with Subsection b above.)
154 |
155 | The source code for a work means the preferred form of the work for
156 | making modifications to it. For an executable work, complete source
157 | code means all the source code for all modules it contains, plus any
158 | associated interface definition files, plus the scripts used to
159 | control compilation and installation of the executable. However, as a
160 | special exception, the source code distributed need not include
161 | anything that is normally distributed (in either source or binary
162 | form) with the major components (compiler, kernel, and so on) of the
163 | operating system on which the executable runs, unless that component
164 | itself accompanies the executable.
165 |
166 | If distribution of executable or object code is made by offering
167 | access to copy from a designated place, then offering equivalent
168 | access to copy the source code from the same place counts as
169 | distribution of the source code, even though third parties are not
170 | compelled to copy the source along with the object code.
171 |
172 | 4. You may not copy, modify, sublicense, or distribute the Program
173 | except as expressly provided under this License. Any attempt
174 | otherwise to copy, modify, sublicense or distribute the Program is
175 | void, and will automatically terminate your rights under this License.
176 | However, parties who have received copies, or rights, from you under
177 | this License will not have their licenses terminated so long as such
178 | parties remain in full compliance.
179 |
180 | 5. You are not required to accept this License, since you have not
181 | signed it. However, nothing else grants you permission to modify or
182 | distribute the Program or its derivative works. These actions are
183 | prohibited by law if you do not accept this License. Therefore, by
184 | modifying or distributing the Program (or any work based on the
185 | Program), you indicate your acceptance of this License to do so, and
186 | all its terms and conditions for copying, distributing or modifying
187 | the Program or works based on it.
188 |
189 | 6. Each time you redistribute the Program (or any work based on the
190 | Program), the recipient automatically receives a license from the
191 | original licensor to copy, distribute or modify the Program subject to
192 | these terms and conditions. You may not impose any further
193 | restrictions on the recipients' exercise of the rights granted herein.
194 | You are not responsible for enforcing compliance by third parties to
195 | this License.
196 |
197 | 7. If, as a consequence of a court judgment or allegation of patent
198 | infringement or for any other reason (not limited to patent issues),
199 | conditions are imposed on you (whether by court order, agreement or
200 | otherwise) that contradict the conditions of this License, they do not
201 | excuse you from the conditions of this License. If you cannot
202 | distribute so as to satisfy simultaneously your obligations under this
203 | License and any other pertinent obligations, then as a consequence you
204 | may not distribute the Program at all. For example, if a patent
205 | license would not permit royalty-free redistribution of the Program by
206 | all those who receive copies directly or indirectly through you, then
207 | the only way you could satisfy both it and this License would be to
208 | refrain entirely from distribution of the Program.
209 |
210 | If any portion of this section is held invalid or unenforceable under
211 | any particular circumstance, the balance of the section is intended to
212 | apply and the section as a whole is intended to apply in other
213 | circumstances.
214 |
215 | It is not the purpose of this section to induce you to infringe any
216 | patents or other property right claims or to contest validity of any
217 | such claims; this section has the sole purpose of protecting the
218 | integrity of the free software distribution system, which is
219 | implemented by public license practices. Many people have made
220 | generous contributions to the wide range of software distributed
221 | through that system in reliance on consistent application of that
222 | system; it is up to the author/donor to decide if he or she is willing
223 | to distribute software through any other system and a licensee cannot
224 | impose that choice.
225 |
226 | This section is intended to make thoroughly clear what is believed to
227 | be a consequence of the rest of this License.
228 |
229 | 8. If the distribution and/or use of the Program is restricted in
230 | certain countries either by patents or by copyrighted interfaces, the
231 | original copyright holder who places the Program under this License
232 | may add an explicit geographical distribution limitation excluding
233 | those countries, so that distribution is permitted only in or among
234 | countries not thus excluded. In such case, this License incorporates
235 | the limitation as if written in the body of this License.
236 |
237 | 9. The Free Software Foundation may publish revised and/or new versions
238 | of the General Public License from time to time. Such new versions will
239 | be similar in spirit to the present version, but may differ in detail to
240 | address new problems or concerns.
241 |
242 | Each version is given a distinguishing version number. If the Program
243 | specifies a version number of this License which applies to it and "any
244 | later version", you have the option of following the terms and conditions
245 | either of that version or of any later version published by the Free
246 | Software Foundation. If the Program does not specify a version number of
247 | this License, you may choose any version ever published by the Free Software
248 | Foundation.
249 |
250 | 10. If you wish to incorporate parts of the Program into other free
251 | programs whose distribution conditions are different, write to the author
252 | to ask for permission. For software which is copyrighted by the Free
253 | Software Foundation, write to the Free Software Foundation; we sometimes
254 | make exceptions for this. Our decision will be guided by the two goals
255 | of preserving the free status of all derivatives of our free software and
256 | of promoting the sharing and reuse of software generally.
257 |
258 | NO WARRANTY
259 |
260 | 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
261 | FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
262 | OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
263 | PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
264 | OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
265 | MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
266 | TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
267 | PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
268 | REPAIR OR CORRECTION.
269 |
270 | 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
271 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
272 | REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
273 | INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
274 | OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
275 | TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
276 | YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
277 | PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
278 | POSSIBILITY OF SUCH DAMAGES.
279 |
280 | END OF TERMS AND CONDITIONS
281 |
282 | How to Apply These Terms to Your New Programs
283 |
284 | If you develop a new program, and you want it to be of the greatest
285 | possible use to the public, the best way to achieve this is to make it
286 | free software which everyone can redistribute and change under these terms.
287 |
288 | To do so, attach the following notices to the program. It is safest
289 | to attach them to the start of each source file to most effectively
290 | convey the exclusion of warranty; and each file should have at least
291 | the "copyright" line and a pointer to where the full notice is found.
292 |
293 | {description}
294 | Copyright (C) {year} {fullname}
295 |
296 | This program is free software; you can redistribute it and/or modify
297 | it under the terms of the GNU General Public License as published by
298 | the Free Software Foundation; either version 2 of the License, or
299 | (at your option) any later version.
300 |
301 | This program is distributed in the hope that it will be useful,
302 | but WITHOUT ANY WARRANTY; without even the implied warranty of
303 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
304 | GNU General Public License for more details.
305 |
306 | You should have received a copy of the GNU General Public License along
307 | with this program; if not, write to the Free Software Foundation, Inc.,
308 | 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
309 |
310 | Also add information on how to contact you by electronic and paper mail.
311 |
312 | If the program is interactive, make it output a short notice like this
313 | when it starts in an interactive mode:
314 |
315 | Gnomovision version 69, Copyright (C) year name of author
316 | Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
317 | This is free software, and you are welcome to redistribute it
318 | under certain conditions; type `show c' for details.
319 |
320 | The hypothetical commands `show w' and `show c' should show the appropriate
321 | parts of the General Public License. Of course, the commands you use may
322 | be called something other than `show w' and `show c'; they could even be
323 | mouse-clicks or menu items--whatever suits your program.
324 |
325 | You should also get your employer (if you work as a programmer) or your
326 | school, if any, to sign a "copyright disclaimer" for the program, if
327 | necessary. Here is a sample; alter the names:
328 |
329 | Yoyodyne, Inc., hereby disclaims all copyright interest in the program
330 | `Gnomovision' (which makes passes at compilers) written by James Hacker.
331 |
332 | {signature of Ty Coon}, 1 April 1989
333 | Ty Coon, President of Vice
334 |
335 | This General Public License does not permit incorporating your program into
336 | proprietary programs. If your program is a subroutine library, you may
337 | consider it more useful to permit linking proprietary applications with the
338 | library. If this is what you want to do, use the GNU Lesser General
339 | Public License instead of this License.
340 |
341 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | 
2 |
3 |
4 |
5 | We can program a computer to do anything. What if we had the same power over the molecules of our bodies?
6 |
7 | The official chemlambda page is now: [Chemlambda projects page](https://chemlambda.github.io/index.html)
8 |
9 |
10 |
11 |
12 | The repository chemlambda-gui is no longer active. For new experiments, go to the [official page](https://chemlambda.github.io/index.html).
13 |
14 |
15 | If you still want to explore this repository, then go to the branch: https://github.com/chorasimilarity/chemlambda-gui/tree/gh-pages/dynamic
16 |
17 |
--------------------------------------------------------------------------------
/chemlambda4.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/chorasimilarity/chemlambda-gui/8df1324f9222588bbe36b949b8c9dc5c89efab2c/chemlambda4.jpg
--------------------------------------------------------------------------------
/dynamic/20_quine.mol:
--------------------------------------------------------------------------------
1 | FOE 6 16 7
2 | FOE 8 18 9
3 | FOE 10 20 11
4 | FOE 24 1 15
5 | FOE 26 30 17
6 | A 15 2 6
7 | A 30 16 27
8 | A 17 7 8
9 | A 36 1 37
10 | FI 28 42 26
11 | FI 33 32 38
12 | FI 38 39 24
13 | FI 19 31 28
14 | FI 21 35 34
15 | FI 34 37 33
16 | L 27 42 39
17 | L 18 31 32
18 | L 9 19 10
19 | L 20 35 36
20 | L 11 21 2
--------------------------------------------------------------------------------
/dynamic/9_quine.mol:
--------------------------------------------------------------------------------
1 | FOE 1 11 10
2 | FOE 9 17 16
3 | FOE 7 15 14
4 | A 8 6 5
5 | A 16 14 6
6 | A 17 15 7
7 | FI 12 13 1
8 | L 10 12 8
9 | L 11 13 9
--------------------------------------------------------------------------------
/dynamic/README.md:
--------------------------------------------------------------------------------
1 | The official page of all chemlambda projects is https://chemlambda.github.io/index.html
2 |
3 | The repository chemlambda-gui is kept because of the content, otherwise, for new experiments, go to the official page.
4 |
5 | The active branch of this repository is https://github.com/chorasimilarity/chemlambda-gui/tree/gh-pages/dynamic
6 |
7 | _______
8 |
9 |
10 |
11 | This is a collection of scripts and experiments with chemlambda.
12 |
13 | Everything new happens at the branch https://github.com/chorasimilarity/chemlambda-gui/tree/gh-pages/dynamic
14 |
15 | See:
16 | - the demos page http://chorasimilarity.github.io/chemlambda-gui/dynamic/demos.html
17 | - the moves and explanations, references http://chorasimilarity.github.io/chemlambda-gui/dynamic/moves.html
18 | - the vision page http://chorasimilarity.github.io/chemlambda-gui/dynamic/vision.html
19 |
20 | I use all the time my open notebook https://chorasimilarity.wordpress.com/ for more explanations and details.
21 |
22 | Older gallery of examples, explanations and dowloads from the page http://imar.ro/~mbuliga/gallery.html
23 |
24 | See also my channel for short videos about chemlambda https://www.youtube.com/channel/UCO2CcqUKORdyXd_CdgEdvVQ/videos
25 |
--------------------------------------------------------------------------------
/dynamic/ackermann_2_2.mol:
--------------------------------------------------------------------------------
1 | A 1 cb o
2 | A 2 ca 1
3 | L 3 a 2
4 | L 4 b 3
5 | A 5 b 4
6 | A 6 sp1 5
7 | A a f 6
8 | L 1s1 ns1 sp1
9 | L 2s1 ss1 1s1
10 | L 3s1 zs1 2s1
11 | A 4s1 5s1 3s1
12 | A 6s1 zs1 5s1
13 | A ns1 7s1 6s1
14 | FO ss1 4s1 7s1
15 | L 1f Af f
16 | L 2f bf 1f
17 | A 3f cone 2f
18 | A 4f Af 3f
19 | A sp2 bf 4f
20 | L 1s2 ns2 sp2
21 | L 2s2 ss2 1s2
22 | L 3s2 zs2 2s2
23 | A 4s2 5s2 3s2
24 | A 6s2 zs2 5s2
25 | A ns2 7s2 6s2
26 | FO ss2 4s2 7s2
27 | L 1cone fcone cone
28 | L 2cone xcone 1cone
29 | A fcone xcone 2cone
30 | L 1ca fca ca
31 | L 2ca xca 1ca
32 | A 3ca 4ca 2ca
33 | A 5ca xca 4ca
34 | FO fca 3ca 5ca
35 | L 1cb fcb cb
36 | L 2cb xcb 1cb
37 | A 3cb 4cb 2cb
38 | A 5cb xcb 4cb
39 | FO fcb 3cb 5cb
--------------------------------------------------------------------------------
/dynamic/firstpart.txt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Chemlambda movies productions presents:
5 |
6 |
7 |
32 |
33 |
34 |
35 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/dynamic/moving_alt.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | printf "choose a file from the list: \n"
5 |
6 | ls *.mol
7 |
8 | printf "> "
9 |
10 | read firstarg
11 |
12 | filename=${firstarg%%.*}
13 |
14 | awk -f check_1_mov2_alt.awk $firstarg
15 |
16 |
17 | cp firstpart.txt "$filename".html
18 |
19 | cat essy.txt >> "$filename".html
20 |
21 | cat lastpart.txt >> "$filename".html
22 |
23 |
--------------------------------------------------------------------------------
/dynamic/moving_random.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | printf "choose a file from the list: \n"
5 |
6 | ls *.mol
7 |
8 | printf "> "
9 |
10 | read firstarg
11 |
12 | filename=${firstarg%%.*}
13 |
14 | awk -f check_1_mov2_rand.awk $firstarg
15 |
16 |
17 | cp firstpart.txt "$filename".html
18 |
19 | cat essy.txt >> "$filename".html
20 |
21 | cat lastpart.txt >> "$filename".html
22 |
23 |
--------------------------------------------------------------------------------
/dynamic/yfrcombtreefo.mol:
--------------------------------------------------------------------------------
1 | A a b o
2 | A c d a
3 | A e f d
4 | A g h b
5 | A j i h
6 | A k l g
7 | A m n l
8 | A p r m
9 | FO cc cc1 cc2
10 | FO cc1 c as
11 | FO cc2 p cc3
12 | FO cc3 cc4 k
13 | FO cc4 5sii1 5sii2
14 | L 2s1 3s1 cc
15 | L 4s1 5s1 2s1
16 | L 6s1 7s1 4s1
17 | A 9s1 8s1 6s1
18 | A 3s1 10s1 9s1
19 | A 5s1 11s1 8s1
20 | FO 7s1 10s1 11s1
21 | L 3k1 2k1 e
22 | L 2k1 4k1 3k1
23 | T 4k1
24 | A 3sii1 2sii1 f
25 | A 5sii1 4sii1 3sii1
26 | L 2i1 2i1 4sii12
27 | FO 4sii12 la1 la2
28 | FO la1 4sii1 2sii1
29 | FO la2 4sii2 2sii2
30 | A 3sii2 2sii2 i
31 | A 5sii2 4sii2 3sii2
32 | L 3k2 2k2 jj
33 | L 2k2 4k2 3k2
34 | T 4k2
35 | FO jj lu1 j
36 | FO lu1 n ak
37 | A ak as r
38 | A o zu za
39 | L zi zi zu
40 | FO za ou1 out
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/0_0_FI_FO_FI_FOE.mol:
--------------------------------------------------------------------------------
1 | FI in 2 1
2 | FO 1 con 2
3 | FI con 22 11
4 | FOE 11 out 22
5 | MULOUT out bubu
6 | MULIN bubu in
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/10_quine_bubbles.mol:
--------------------------------------------------------------------------------
1 | L 5 1 2
2 | FI 1 7 6
3 | A 2 3 4
4 | FI 4 6 9
5 | L 8 7 10
6 | FOE 9 5 8
7 | FOE 10 12 11
8 | A 12 15 13
9 | FOE 13 15 14
10 | A 11 14 3
11 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/16_quine_A_L_FI_FO.mol:
--------------------------------------------------------------------------------
1 | FO a1 a2 a3
2 | L a4 a5 a7
3 | FO a6 a8 a9
4 | FOE a10 a11 a12
5 | FI a7 a20 a10
6 | FI a2 a8 a6
7 | FOE a17 a13 a14
8 | FI a3 a9 a16
9 | A a11 a13 a21
10 | A a12 a14 a4
11 | FI a19 a16 a20
12 | FI a5 a22 a17
13 | FOE a21 a18 a23
14 | FI a15 a24 a22
15 | L a18 a24 a1
16 | L a23 a15 a19
17 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/16_quine_A_L_FI_FO_duplicate.mol:
--------------------------------------------------------------------------------
1 | FO a1 a2 a3
2 | L a4 a5 a7
3 | FO a6 a8 a9
4 | FOE a10 a11 a12
5 | FI a7 a20 a10
6 | FI a2 a8 a6
7 | FOE a17 a13 a14
8 | FI a33 a9 a16
9 | A a11 a13 a21
10 | A a12 a14 a4
11 | FI a19 a16 a20
12 | FI a5 a22 a17
13 | FOE a21 a18 a23
14 | FI a15 a24 a22
15 | L a18 a24 a1
16 | L a23 a15 a19
17 | FI a3 2 1
18 | FO 1 2 a33
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/1_2_FI_FO_FI_FO.mol:
--------------------------------------------------------------------------------
1 | FI 1 in 2
2 | FO 2 1 con
3 | FI 11 22 out
4 | FO con 11 22
5 | MULOUT out bubu
6 | MULIN bubu in
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/20_quine.mol:
--------------------------------------------------------------------------------
1 | FOE 6 16 7
2 | FOE 8 18 9
3 | FOE 10 20 11
4 | FOE 24 1 15
5 | FOE 26 30 17
6 | A 15 2 6
7 | A 30 16 27
8 | A 17 7 8
9 | A 36 1 37
10 | FI 28 42 26
11 | FI 33 32 38
12 | FI 38 39 24
13 | FI 19 31 28
14 | FI 21 35 34
15 | FI 34 37 33
16 | L 27 42 39
17 | L 18 31 32
18 | L 9 19 10
19 | L 20 35 36
20 | L 11 21 2
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/28_quine.mol:
--------------------------------------------------------------------------------
1 | FOE 2 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/2_2_A_FO_FI_L.mol:
--------------------------------------------------------------------------------
1 | A 1 2 con
2 | FO in 1 2
3 | FI 11 22 in
4 | L con 11 22
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/3_3_FI_FO_A_L_gives_16_bubble_quine.mol:
--------------------------------------------------------------------------------
1 | FI in 2 1
2 | FO 1 2 con
3 | A con 22 11
4 | FI 11 23 13
5 | FO 13 23 111
6 | L 111 22 in
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/3_3_FI_FO_A_L_modified_20_bubble_quine.mol:
--------------------------------------------------------------------------------
1 | FI in 2 1
2 | FO 1 2 con
3 | A con 22 11
4 | FI 11 23 13
5 | FO 13 23 111
6 | L 111 22 in
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/3_4_FI_FO_A_L.mol:
--------------------------------------------------------------------------------
1 | FI in 2 1
2 | FO 1 2 con
3 | A 11 con 22
4 | L 22 out 11
5 | MULOUT out bubu
6 | MULIN bubu in
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/3bit.mol:
--------------------------------------------------------------------------------
1 | FI 1 3 2
2 | L 2 3 7
3 | FOE 7 13 12
4 | A 13 9 8
5 | FOE 8 9 10
6 | A 10 12 11
7 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/9_quine.mol:
--------------------------------------------------------------------------------
1 | FOE 1 11 10
2 | FOE 9 17 16
3 | FOE 7 15 14
4 | A 8 6 5
5 | A 16 14 6
6 | A 17 15 7
7 | FI 12 13 1
8 | L 10 12 8
9 | L 11 13 9
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/tame_turing_neuron.mol:
--------------------------------------------------------------------------------
1 | FOE 1 2 out
2 | A 3 2 1
3 | A la ra 3
4 | FI inl1 la1 la
5 | FI inl2 la2 la1
6 | FI inl3 la3 la2
7 | L z z la3
8 | FI inr1 ra1 ra
9 | FI inr2 ra2 ra1
10 | FI inr3 ra3 ra2
11 | FI in b a
12 | L a b ra3
13 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1i
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1o 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2o
29 | A 1m 1ml 1of
30 | FOE 2o 1m 1mr
31 | FOE a 1ml b
32 | A 1mr b a
33 | L 1of dangle 1o
34 | T dangle
35 |
36 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_eating_bit.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1i
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1o 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2o
29 | A 1mout 1ml 1o
30 | FO 1min b13 b12
31 | A b13 b12 1mout
32 | FOE 2o 1min 1mr
33 | FOE a 1ml b
34 | A 1mr b a
35 |
36 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_eating_lterm.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1i
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1o 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2o
29 | A 1m 1ml 1of
30 | FOE 2o 1m 1mr
31 | FOE a 1ml b
32 | A 1mr b a
33 | L 1of dangle 1o
34 | T dangle
35 |
36 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_eating_mulin.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | DISA 12 22 1i
10 | DISA 23 13 22
11 | DISA 41 25 40
12 | DISA 15 5 6
13 | DISA 29 14 25
14 | DISA 30 16 27
15 | DISA 17 7 8
16 | DISA 36 1o 37
17 | DISFI 28 42 26
18 | DISFI 33 32 38
19 | DISFI 38 39 24
20 | DISFI 19 31 28
21 | DISFI 21 35 34
22 | DISFI 34 37 33
23 | DISL 40 41 23
24 | DISL 27 42 39
25 | DISL 18 31 32
26 | DISL 9 19 10
27 | DISL 20 35 36
28 | DISL 11 21 2o
29 | DISA 1m 1ml 1of
30 | FOE 2o 1m 1mr
31 | FOE a 1ml b
32 | DISA 1mr b a
33 | NOP2 1of 1o
34 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_eating_prop.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1i
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1o 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2o
29 | A 1m 1ml 1of
30 | FOE 2o 1m 1mr
31 | FOE a 1ml b
32 | A 1mr b a
33 | PROP 1of 1o
34 |
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_fifo.mol:
--------------------------------------------------------------------------------
1 | FOE 2i 12 3
2 | FOE 3 13 4
3 | FOE 4 14 5
4 | FOE 6 16 7
5 | FOE 8 18 9
6 | FOE 10 20 11
7 | FOE 24 29 15
8 | FOE 26 30 17
9 | A 12 22 1i
10 | A 23 13 22
11 | A 41 25 40
12 | A 15 5 6
13 | A 29 14 25
14 | A 30 16 27
15 | A 17 7 8
16 | A 36 1o 37
17 | FI 28 42 26
18 | FI 33 32 38
19 | FI 38 39 24
20 | FI 19 31 28
21 | FI 21 35 34
22 | FI 34 37 33
23 | L 40 41 23
24 | L 27 42 39
25 | L 18 31 32
26 | L 9 19 10
27 | L 20 35 36
28 | L 11 21 2o
29 | A 1m 1ml 1o
30 | FOE 2o 1m 1mr
31 | FI a 1mr b
32 | FO b a 1ml
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_fifo_back_to_afoe.mol:
--------------------------------------------------------------------------------
1 | FOE a b999999995 b
2 | A b999999996 b a
3 | FI b999995 b999994 b999999916
4 | FI b99999999 b99999998 b999999912
5 | L b9999993 b9999991 b999993
6 | L b999999911 b99999999 b9999993
7 | L b999997 b999995 b999911
8 | L b9999997 b999999913 b999997
9 | FOE in b999999992 b999999993
10 | FI b99999917 b99999919 b999991
11 | A b999999990 b999999992 b999999914
12 | A b999999991 b999999993 b999999915
13 | FI b99999 b999911 out
14 | FOE b999999910 b9999999914 b9999999915
15 | FI b9999999913 b9999999912 b99999998
16 | L b9999999914 b9999999912 b99999996
17 | A b9999999917 b9999999919 b999999911
18 | L b9999999915 b9999999913 b99999997
19 | FI b9999991 b9999990 b999994
20 | FI b99999995 b99999994 b9999990
21 | FI b999991 b999993 b99999
22 | L b99999997 b99999995 b99999919
23 | A b999999913 b999999915 b9999997
24 | FI b99999991 b99999993 b99999917
25 | FOE b999999916 b999999990 b999999991
26 | FOE b99999996 b9999999910 b9999999911
27 | FI b999999999 b999999998 b99999994
28 | L b9999999910 b999999998 b99999992
29 | L b9999999911 b999999999 b99999993
30 | FOE b999999912 b9999999916 b9999999917
31 | FOE b999999914 b9999999918 b9999999919
32 | A b9999999916 b9999999918 b999999910
33 | FO b99999992 b999999996 binter
34 | FI b999999995 binter b99999991
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_fifo_other_bit.mol:
--------------------------------------------------------------------------------
1 | FO b99999990 b999999994 b999999995
2 | FI b999999994 b999999996 b99999990
3 | FI b999995 b999994 b999999916
4 | FI b99999999 b99999998 b999999912
5 | L b9999993 b9999991 b999993
6 | L b999999911 b99999999 b9999993
7 | L b999997 b999995 b999911
8 | L b9999997 b999999913 b999997
9 | FOE in b999999992 b999999993
10 | FI b99999917 b99999919 b999991
11 | A b999999990 b999999992 b999999914
12 | A b999999991 b999999993 b999999915
13 | FI b99999 b999911 out
14 | FOE b999999910 b9999999914 b9999999915
15 | FI b9999999913 b9999999912 b99999998
16 | L b9999999914 b9999999912 b99999996
17 | A b9999999917 b9999999919 b999999911
18 | L b9999999915 b9999999913 b99999997
19 | FI b9999991 b9999990 b999994
20 | FI b99999995 b99999994 b9999990
21 | FI b999991 b999993 b99999
22 | L b99999997 b99999995 b99999919
23 | A b999999913 b999999915 b9999997
24 | FI b99999991 b99999993 b99999917
25 | FOE b999999916 b999999990 b999999991
26 | FOE b99999996 b9999999910 b9999999911
27 | FI b999999999 b999999998 b99999994
28 | L b9999999910 b999999998 b99999992
29 | L b9999999911 b999999999 b99999993
30 | FOE b999999912 b9999999916 b9999999917
31 | FOE b999999914 b9999999918 b9999999919
32 | A b9999999916 b9999999918 b999999910
33 | FO b99999992 b999999996 bintero
34 | FI b999999995 binteri b99999991
35 | FO bintero b13 b12
36 | A b13 b12 binteri
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_fifo_step8.mol:
--------------------------------------------------------------------------------
1 | FO b99999990 b999999994 b999999995
2 | FI b999999994 b999999996 b99999990
3 | FI b999995 b999994 b999999916
4 | FI b99999999 b99999998 b999999912
5 | L b9999993 b9999991 b999993
6 | L b999999911 b99999999 b9999993
7 | L b999997 b999995 b999911
8 | L b9999997 b999999913 b999997
9 | FOE in b999999992 b999999993
10 | FI b99999917 b99999919 b999991
11 | A b999999990 b999999992 b999999914
12 | A b999999991 b999999993 b999999915
13 | FI b99999 b999911 out
14 | FOE b999999910 b9999999914 b9999999915
15 | FI b9999999913 b9999999912 b99999998
16 | L b9999999914 b9999999912 b99999996
17 | A b9999999917 b9999999919 b999999911
18 | L b9999999915 b9999999913 b99999997
19 | FI b9999991 b9999990 b999994
20 | FI b99999995 b99999994 b9999990
21 | FI b999991 b999993 b99999
22 | L b99999997 b99999995 b99999919
23 | A b999999913 b999999915 b9999997
24 | FI b99999991 b99999993 b99999917
25 | FOE b999999916 b999999990 b999999991
26 | FOE b99999996 b9999999910 b9999999911
27 | FI b999999999 b999999998 b99999994
28 | L b9999999910 b999999998 b99999992
29 | L b9999999911 b999999999 b99999993
30 | FOE b999999912 b9999999916 b9999999917
31 | FOE b999999914 b9999999918 b9999999919
32 | A b9999999916 b9999999918 b999999910
33 | FO b99999992 b999999996 binter
34 | FI b999999995 binter b99999991
--------------------------------------------------------------------------------
/quines_periodics_and_walkers/walker_fifo_walker_afoe.mol:
--------------------------------------------------------------------------------
1 | FI b999995 b999994 b999999916
2 | FI b99999999 b99999998 b999999912
3 | L b9999993 b9999991 b999993
4 | L b999999911 b99999999 b9999993
5 | L b999997 b999995 b999911
6 | L b9999997 b999999913 b999997
7 | FOE in b999999992 b999999993
8 | FI b99999917 b99999919 b999991
9 | A b999999990 b999999992 b999999914
10 | A b999999991 b999999993 b999999915
11 | FI b99999 b999911 out
12 | FOE b999999910 b9999999914 b9999999915
13 | FI b9999999913 b9999999912 b99999998
14 | L b9999999914 b9999999912 b99999996
15 | A b9999999917 b9999999919 b999999911
16 | L b9999999915 b9999999913 b99999997
17 | FI b9999991 b9999990 b999994
18 | FI b99999995 b99999994 b9999990
19 | FI b999991 b999993 b99999
20 | L b99999997 b99999995 b99999919
21 | A b999999913 b999999915 b9999997
22 | FI b99999991 b99999993 b99999917
23 | FOE b999999916 b999999990 b999999991
24 | FOE b99999996 b9999999910 b9999999911
25 | FI b999999999 b999999998 b99999994
26 | L b9999999910 b999999998 b99999992
27 | L b9999999911 b999999999 b99999993
28 | FOE b999999912 b9999999916 b9999999917
29 | FOE b999999914 b9999999918 b9999999919
30 | A b9999999916 b9999999918 b999999910
31 | FO b99999992 b999999996 binter
32 | FI b999999995 binter b99999991
33 | FOE 2i 12 3
34 | FOE 3 13 4
35 | FOE 4 14 5
36 | FOE 6 16 7
37 | FOE 8 18 9
38 | FOE 10 20 11
39 | FOE 24 29 15
40 | FOE 26 30 17
41 | A 12 22 1i
42 | A 23 13 22
43 | A 41 25 40
44 | A 15 5 6
45 | A 29 14 25
46 | A 30 16 27
47 | A 17 7 8
48 | A 36 1o 37
49 | FI 28 42 26
50 | FI 33 32 38
51 | FI 38 39 24
52 | FI 19 31 28
53 | FI 21 35 34
54 | FI 34 37 33
55 | L 40 41 23
56 | L 27 42 39
57 | L 18 31 32
58 | L 9 19 10
59 | L 20 35 36
60 | L 11 21 2o
61 | A 1mout b999999996 1o
62 | FO 1min b13 b12
63 | A b13 b12 1mout
64 | FOE 2o 1min b999999995
--------------------------------------------------------------------------------
/scripts_and_mol_files/10_quine_bubbles.mol:
--------------------------------------------------------------------------------
1 | L 5 1 2
2 | FI 1 7 6
3 | A 2 3 4
4 | FI 4 6 9
5 | L 8 7 10
6 | FOE 9 5 8
7 | FOE 10 12 11
8 | A 12 15 13
9 | FOE 13 15 14
10 | A 11 14 3
11 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/2neurons.mol:
--------------------------------------------------------------------------------
1 | FO 3 1 2
2 | FI 2 4 3
3 | L 6 5 4
4 | FOE 5 u1 51
5 | FOE 51 u2 52
6 | FOE 52 u3 53
7 | FI 61 u1 6
8 | FI 62 u2 61
9 | FI 63 u3 62
10 |
11 | A 23 12 63
12 | FOE 12p b13 b12
13 | A b13 b12 12
14 | L 24 12p 14
15 | A 33 22 23
16 | L 34 22 24
17 | A 43 32 33
18 | FOE 32p b33 b32
19 | A b33 b32 32
20 | L 44 32p 34
21 | A 53 42 43
22 | L 14 42 44
23 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/ackermann_2_2.mol:
--------------------------------------------------------------------------------
1 | A 1 cb o
2 | A 2 ca 1
3 | L 3 a 2
4 | L 4 b 3
5 | A 5 b 4
6 | A 6 sp1 5
7 | A a f 6
8 | L 1s1 ns1 sp1
9 | L 2s1 ss1 1s1
10 | L 3s1 zs1 2s1
11 | A 4s1 5s1 3s1
12 | A 6s1 zs1 5s1
13 | A ns1 7s1 6s1
14 | FO ss1 4s1 7s1
15 | L 1f Af f
16 | L 2f bf 1f
17 | A 3f cone 2f
18 | A 4f Af 3f
19 | A sp2 bf 4f
20 | L 1s2 ns2 sp2
21 | L 2s2 ss2 1s2
22 | L 3s2 zs2 2s2
23 | A 4s2 5s2 3s2
24 | A 6s2 zs2 5s2
25 | A ns2 7s2 6s2
26 | FO ss2 4s2 7s2
27 | L 1cone fcone cone
28 | L 2cone xcone 1cone
29 | A fcone xcone 2cone
30 | L 1ca fca ca
31 | L 2ca xca 1ca
32 | A 3ca 4ca 2ca
33 | A 5ca xca 4ca
34 | FO fca 3ca 5ca
35 | L 1cb fcb cb
36 | L 2cb xcb 1cb
37 | A 3cb 4cb 2cb
38 | A 5cb xcb 4cb
39 | FO fcb 3cb 5cb
--------------------------------------------------------------------------------
/scripts_and_mol_files/assembler.mol:
--------------------------------------------------------------------------------
1 | FO 2 4 3
2 | FI 3 1 2
3 | A xa ya 1
4 | FI a11 a1 xa
5 | L v1 u1 a1
6 | FI a22 a2 a11
7 | L v2 u2 a2
8 | FI a33 a3 a22
9 | L v3 u3 a3
10 | FI a44 a4 a33
11 | L v4 u4 a4
12 | FI a55 a5 a44
13 | L v5 u5 a5
14 | A ca2 u1 ca1
15 | A ca3 u2 ca2
16 | A ca4 u3 ca3
17 | A ca5 u4 ca4
18 | A ca6 u5 ca5
19 | FI b11 b1 ya
20 | FI b22 b2 b11
21 | FI b33 b3 b22
22 | FI b44 b4 b33
23 | FI b55 b5 b44
24 | L la2 b1 la1
25 | L la3 b2 la2
26 | L la4 b3 la3
27 | L la5 b4 la4
28 | L la6 b5 la5
--------------------------------------------------------------------------------
/scripts_and_mol_files/bitbit.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 |
4 | bitin0=( ' in 2 1\n' ' 1 in 2\n' ' 1 2 con\n' ' in 2 1\n' ' 1 in 2\n' ' 2 1 con\n' )
5 |
6 | bitin1=( ' 1 con 2\n' ' 2 1 con\n' ' in 1 2\n' ' 1 2 con\n' ' 2 con 1\n' ' in 1 2\n' )
7 |
8 | bitout0=( ' con 22 12\n' ' 12 con 22\n' ' 12 22 out\n' ' con 22 12\n' ' 12 con 22\n' ' 22 12 out\n' )
9 |
10 | bitout1=( ' 12 out 22\n' ' 22 12 out\n' ' con 12 22\n' ' 12 22 out\n' ' 22 out 12\n' ' con 12 22\n' )
11 |
12 | alfa=( 'A' 'FI' )
13 |
14 |
15 | beta=( 'L' 'FO' 'FOE' )
16 |
17 | for ((i=0; i<=1; i++))
18 | do
19 |
20 | for ((j=0; j<=2; j++))
21 | do
22 |
23 | for ((k=0; k<=1; k++))
24 | do
25 |
26 | for ((l=0; l<=2; l++))
27 | do
28 |
29 | vali=${alfa[$i]}
30 |
31 | valj=${beta[$j]}
32 |
33 | valk=${alfa[$k]}
34 |
35 | vall=${beta[$l]}
36 |
37 | valtot="_"$vali"_"$valj"_"$valk"_"$vall
38 |
39 |
40 | for ((a=0; a<=5; a++))
41 | do
42 |
43 |
44 | for ((b=0; b<=5; b++))
45 | do
46 |
47 | filename=$a"_"$b"_"$valtot".mol"
48 |
49 | valbitin0=${bitin0[$a]}
50 |
51 | valbitin1=${bitin1[$a]}
52 |
53 | valbitout0=${bitout0[$b]}
54 |
55 | valbitout1=${bitout1[$b]}
56 |
57 | vmulout='MULOUT out bubu\n MULIN bubu in'
58 |
59 | gugu=$vali$valbitin0$valj$valbitin1$valk$valbitout0$vall$valbitout1$vmulout
60 |
61 | echo -e $gugu > $filename
62 |
63 | awk -f foe_bubbles_bit_exp.awk $filename
64 |
65 |
66 | printf "$filename" >> data.txt
67 |
68 | printf "\n" >> data.txt
69 |
70 | for ((aa=1; aa<=7; aa++))
71 | do
72 |
73 | printf " " > temp_added_nodes
74 |
75 | printf " " > temp_trashed_nodes
76 |
77 | awk -f foe_bubbles_bit_exp.awk temp_final_nodes
78 |
79 |
80 | add_nodes=`wc -l temp_added_nodes | awk '{print $1'}`
81 |
82 | trash_nodes=`wc -l temp_trashed_nodes | awk '{print $1'}`
83 |
84 | no_nodes=`wc -l temp_final_nodes | awk '{print $1'}`
85 |
86 | cat temp_for_count >> data.txt
87 |
88 | printf "\n" >> data.txt
89 |
90 | rm temp_added_nodes
91 |
92 | rm temp_trashed_nodes
93 |
94 | done
95 |
96 | rm $filename
97 |
98 | printf "\n" >> data.txt
99 |
100 |
101 |
102 | rm temp_*
103 |
104 |
105 |
106 | done
107 |
108 | done
109 |
110 | done
111 |
112 | done
113 |
114 | done
115 |
116 | done
117 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/check_1_foe.awk:
--------------------------------------------------------------------------------
1 | BEGIN {
2 |
3 | # forked from check_1.awk version 22.09.2014
4 | #
5 | # this program reads a .mol file and produces the json. version 29.09.2014. owner: chorasimilarity (Marius Buliga, http://chorasimilarity.wordpress.com/ )
6 | #
7 |
8 | main_const=4;
9 |
10 | left=2;
11 |
12 | right=1;
13 |
14 | middle=1;
15 |
16 | green_col="#04B431";
17 |
18 | red_col="#FF0000";
19 |
20 | in_col="#FFFF00";
21 |
22 | out_col="#2E2EFE";
23 |
24 | bond_int=2;
25 |
26 | bond_ext=1;
27 |
28 | term_col="#7F8C8D";
29 |
30 | arrow_col="#ECF0F1";
31 |
32 |
33 |
34 |
35 | count_lines=0;
36 |
37 | }
38 |
39 | {
40 |
41 |
42 | #
43 | # node has as argument the node number and as value the node record, as read from the input .mol file
44 | #
45 |
46 |
47 | #
48 | # a .mol file is simply a list of nodes and their ports. Each node is on a line, for example T[a] is written "T a" , Arrow[a,b] is written "Arrow a b" and FO[a,b,c] is written "FO a b c"
49 | #
50 | #
51 |
52 |
53 |
54 | # ignores the lines with less than 2 fields (no loop element)
55 |
56 | if (NF == 2) {
57 |
58 | node[NR]=$0; node_type[NR]=$1;
59 |
60 | node_port_1[NR]=$2;
61 |
62 | b=$2;
63 |
64 | }
65 |
66 |
67 | #
68 | # node_type has as argument the node number and as value the node type.
69 |
70 | if ( NF == 3 ) { node_type[NR]=$1; node[NR]=$0;
71 |
72 | node_port_1[NR]=$2;
73 |
74 | node_port_2[NR]=$3;}
75 |
76 | if (NF == 4) { node_port_1[NR]=$2; node[NR]=$0; node_type[NR]=$1;
77 |
78 | node_port_2[NR]=$3; node_port_3[NR]=$4; }
79 |
80 |
81 | }
82 |
83 | END {
84 |
85 |
86 |
87 | #
88 | # a bijective function between the id of the nodes and the number (from json file)
89 | #
90 |
91 | j=0;
92 |
93 | for ( i in node) {
94 |
95 | nu_node[i]=j;
96 | node_nu[j]=i;
97 | s=node_type[i];
98 | if (s == "A") { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
99 | used_port_i[a]++;
100 | used_port_i[b]++;
101 | used_port_i[c]++;
102 | used_port[a]++;
103 | used_port[b]++;
104 | used_port[c]++;
105 | all_node_text[j]=s;
106 | all_node_size[j]=main_const;
107 | all_node_colour[j]=green_col;
108 | all_edge_target[a]=j+1; all_edge_target[b]=j+2; all_edge_source[c]=j+3;
109 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
110 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
111 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
112 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
113 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
114 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
115 | j++;
116 | # all_node_text[j]="port_1" zu;
117 | all_node_text[j]=a;
118 | all_node_size[j]=left;
119 | all_node_colour[j]=in_col;
120 | j++;
121 | # all_node_text[j]="port_2" zu;
122 | all_node_text[j]=b;
123 | all_node_size[j]=right;
124 | all_node_colour[j]=in_col;
125 | j++;
126 | # all_node_text[j]="port_3" zu;
127 | all_node_text[j]=c;
128 | all_node_size[j]=middle;
129 | all_node_colour[j]=out_col;
130 | }
131 | if (s == "FI") { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
132 | used_port_i[a]++;
133 | used_port_i[b]++;
134 | used_port_i[c]++;
135 | used_port[a]++;
136 | used_port[b]++;
137 | used_port[c]++;
138 | all_node_text[j]=s;
139 | all_node_size[j]=main_const;
140 | all_node_colour[j]=red_col;
141 | all_edge_target[a]=j+1; all_edge_target[b]=j+2; all_edge_source[c]=j+3;
142 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
143 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
144 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
145 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
146 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
147 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
148 | j++;
149 | # all_node_text[j]="port_1" zu;
150 | all_node_text[j]=a;
151 | all_node_size[j]=left;
152 | all_node_colour[j]=in_col;
153 | j++;
154 | # all_node_text[j]="port_2" zu;
155 | all_node_text[j]=b;
156 | all_node_size[j]=right;
157 | all_node_colour[j]=in_col;
158 | j++;
159 | # all_node_text[j]="port_3" zu;
160 | all_node_text[j]=c;
161 | all_node_size[j]=middle;
162 | all_node_colour[j]=out_col;
163 | }
164 | if (s == "L") { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
165 | used_port_i[a]++;
166 | used_port_i[b]++;
167 | used_port_i[c]++;
168 | used_port[a]++;
169 | used_port[b]++;
170 | used_port[c]++;
171 | all_node_text[j]=s;
172 | all_node_size[j]=main_const;
173 | all_node_colour[j]=red_col;
174 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
175 |
176 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
177 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
178 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
179 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
180 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
181 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
182 |
183 | j++;
184 | # all_node_text[j]="port_1" zu;
185 | all_node_text[j]=a;
186 | all_node_size[j]=middle;
187 | all_node_colour[j]=in_col;
188 | j++;
189 | # all_node_text[j]="port_2" zu;
190 | all_node_text[j]=b;
191 | all_node_size[j]=left;
192 | all_node_colour[j]=out_col;
193 | j++;
194 | # all_node_text[j]="port_3" zu;
195 | all_node_text[j]=c;
196 | all_node_size[j]=right;
197 | all_node_colour[j]=out_col;
198 | }
199 | if (s == "FO" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
200 | used_port_i[a]++;
201 | used_port_i[b]++;
202 | used_port_i[c]++;
203 | used_port[a]++;
204 | used_port[b]++;
205 | used_port[c]++;
206 |
207 | all_node_text[j]=s;
208 | all_node_size[j]=main_const;
209 | all_node_colour[j]=green_col;
210 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
211 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
212 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
213 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
214 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
215 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
216 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
217 | j++;
218 | # all_node_text[j]="port_1" zu;
219 | all_node_text[j]=a;
220 | all_node_size[j]=middle;
221 | all_node_colour[j]=in_col;
222 | j++;
223 | # all_node_text[j]="port_2" zu;
224 | all_node_text[j]=b;
225 | all_node_size[j]=left;
226 | all_node_colour[j]=out_col;
227 | j++;
228 | # all_node_text[j]="port_3" zu;
229 | all_node_text[j]=c;
230 | all_node_size[j]=right;
231 | all_node_colour[j]=out_col;
232 | }
233 | if ( s == "FOE" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
234 | used_port_i[a]++;
235 | used_port_i[b]++;
236 | used_port_i[c]++;
237 | used_port[a]++;
238 | used_port[b]++;
239 | used_port[c]++;
240 |
241 | all_node_text[j]=s;
242 | all_node_size[j]=main_const;
243 | all_node_colour[j]=in_col;
244 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
245 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
246 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
247 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
248 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
249 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
250 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
251 | j++;
252 | # all_node_text[j]="port_1" zu;
253 | all_node_text[j]=a;
254 | all_node_size[j]=middle;
255 | all_node_colour[j]=in_col;
256 | j++;
257 | # all_node_text[j]="port_2" zu;
258 | all_node_text[j]=b;
259 | all_node_size[j]=left;
260 | all_node_colour[j]=out_col;
261 | j++;
262 | # all_node_text[j]="port_3" zu;
263 | all_node_text[j]=c;
264 | all_node_size[j]=right;
265 | all_node_colour[j]=out_col;
266 | }
267 | if (s == "Arrow") { zu=s node_port_1[i] node_port_2[i]; a=node_port_1[i]; b=node_port_2[i];
268 | used_port_i[a]++;
269 | used_port_i[b]++;
270 | used_port[a]++;
271 | used_port[b]++;
272 | all_node_text[j]=s;
273 | all_node_size[j]=main_const;
274 | all_node_colour[j]=arrow_col;
275 | all_edge_target[a]=j+1; all_edge_source[b]=j+2;
276 | x1=zu "port_1"; x2=zu "port_2";
277 | used_port[x1]++; used_port[x2]++;
278 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
279 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
280 | used_port[x1]++; used_port[x2]++;
281 | j++;
282 | # all_node_text[j]="port_1" zu;
283 | all_node_text[j]=a;
284 | all_node_size[j]=middle;
285 | all_node_colour[j]=in_col;
286 | j++;
287 | # all_node_text[j]="port_2" zu;
288 | all_node_text[j]=b;
289 | all_node_size[j]=middle;
290 | all_node_colour[j]=out_col;
291 | }
292 |
293 | if (s == "T" ) { zu=s node_port_1[i]; a=node_port_1[i];
294 | used_port_i[a]++;
295 | used_port[a]++;
296 | all_node_text[j]=s;
297 | all_node_size[j]=main_const;
298 | all_node_colour[j]=term_col;
299 | all_edge_target[a]=j+1;
300 | x1=zu "port_1";
301 | used_port[x1]++;
302 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
303 | used_port[x1]++;
304 | j++;
305 | # all_node_text[j]="port_1" zu;
306 | all_node_text[j]=a;
307 | all_node_size[j]=middle;
308 | all_node_colour[j]=in_col;
309 | }
310 | if (s == "FROUT" ) { zu=s node_port_1[i]; a=node_port_1[i];
311 | used_port_i[a]++;
312 | used_port[a]++;
313 | all_node_text[j]=s;
314 | all_node_size[j]=main_const;
315 | all_node_colour[j]=out_col;
316 | all_edge_target[a]=j+1;
317 | x1=zu "port_1";
318 | used_port[x1]++;
319 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
320 | used_port[x1]++;
321 | j++;
322 | # all_node_text[j]="port_1" zu;
323 | all_node_text[j]=a;
324 | all_node_size[j]=middle;
325 | all_node_colour[j]=in_col;
326 | }
327 | if (s == "FRIN" ) { zu=s node_port_1[i]; a=node_port_1[i]; used_port_i[a]++;
328 | used_port[a]++;
329 | all_node_text[j]=s;
330 | all_node_size[j]=main_const;
331 | all_node_colour[j]=in_col;
332 | all_edge_source[a]=j+1;
333 | x1=zu "port_1";
334 | used_port[x1]++;
335 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
336 | used_port[x1]++;
337 | j++;
338 | # all_node_text[j]="port_1" zu;
339 | all_node_text[j]=a;
340 | all_node_size[j]=middle;
341 | all_node_colour[j]=out_col;
342 | }
343 |
344 | j++;
345 | }
346 |
347 | j--;
348 | jmax=j;
349 |
350 | for (i in used_port_i ) { all_edge_bond[i]=bond_ext;}
351 |
352 | printf("{ \n \"nodes\": [ \n {\"atom\": \""all_node_text[0]"\", \"size\": " all_node_size[0] ", \"colour\": \"" all_node_colour[0] "\"}") > "graph_before.json";
353 |
354 | for (k=1;k<=jmax; k++) {
355 |
356 | printf(", \n {\"atom\": \""all_node_text[k]"\", \"size\": " all_node_size[k] ", \"colour\": \"" all_node_colour[k] "\"}") >> "graph_before.json";
357 | }
358 |
359 | printf(" \n ], \n \"links\": [ \n") >> "graph_before.json";
360 |
361 | cucu=0;
362 |
363 | for (i in used_port) { a=used_port[i]; if (a == 2) { if (cucu == 0 ){
364 |
365 | printf("{\"source\": " all_edge_source[i] ", \"target\": " all_edge_target[i] ", \"bond\": " all_edge_bond[i] "}") >> "graph_before.json"; cucu++; } else{
366 | printf(", \n {\"source\": " all_edge_source[i] ", \"target\": " all_edge_target[i] ", \"bond\": " all_edge_bond[i] "}") >> "graph_before.json"; } }}
367 |
368 | printf(" \n ] \n }") >> "graph_before.json";
369 |
370 | ###################################
371 |
372 |
373 | }
374 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/convert.mol:
--------------------------------------------------------------------------------
1 | L a b i1
2 | FO i1 1 1l
3 | FO 1l 2 2l
4 | FO 2l 3 3l
5 | FO 3l 4 4l
6 | FO 4l 5 5l
7 | FO 5l 6 6l
8 | FO 6l 7 7l
9 | FO 7l 8 8l
10 | FO 8l 9 9l
11 | FO 9l 10 11
12 | A 1 1r o
13 | A 2 2r 1r
14 | A 3 3r 2r
15 | A 4 4r 3r
16 | A 5 5r 4r
17 | A 6 6r 5r
18 | A 7 7r 6r
19 | A 8 8r 7r
20 | A 9 9r 8r
21 | A 10 10r 9r
22 | A 11 i2 10r
23 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/conzipper.mol:
--------------------------------------------------------------------------------
1 | L 1 1 2
2 | FOE 2 3 4
3 | FOE 3 5 6
4 | FOE 5 7 8
5 | FOE 7 9 10
6 | FOE 9 11 12
7 | FOE 11 13 14
8 | FOE 13 15 16
9 | A 15 f2 f1
10 | FOE f1 f2 o
11 | A 4 f a
12 | A 6 b j
13 | A 8 i d
14 | A 10 e m
15 | A 12 l g
16 | A 14 h n
17 | A 16 p k
18 | L a b c
19 | L d e f
20 | L g h i
21 | A j k l
22 | A m n p
23 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/double_s.mol:
--------------------------------------------------------------------------------
1 | L 2 x 1
2 | L 3 y 2
3 | L 4 z 3
4 | A 5 6 4
5 | A x 7 5
6 | A y 8 6
7 | FO z 7 8
8 | FO 1 a b
9 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/fineuron.mol:
--------------------------------------------------------------------------------
1 | FO 2 4 3
2 | FI 3 1 2
3 | A 5 za 1
4 | A xa ya 5
5 | FI a1 b1 xa
6 | FI c1 d1 ya
7 | FI e1 f1 za
8 | FI a2 b2 a1
9 | FI c2 d2 c1
10 | FI e2 f2 e1
11 | FI a3 b3 a2
12 | FI c3 d3 c2
13 | FI e3 f3 e2
14 | FI a4 b4 a3
15 | FI c4 d4 c3
16 | FI e4 f4 e3
17 | A uu11 zz11 vv11
18 | L vv11 zz11 b1
19 | A vv21 uu21 zz21
20 | L zz21 vv21 d1
21 | FOE uu31 vv31 zz31
22 | A vv31 zz31 f1
23 | A uu12 zz12 vv12
24 | L vv12 zz12 d2
25 | A vv22 uu22 zz22
26 | L zz22 vv22 f2
27 | FOE uu32 vv32 zz32
28 | A vv32 zz32 b2
29 | A uu13 zz13 vv13
30 | L vv13 zz13 f3
31 | A vv23 uu23 zz23
32 | L zz23 vv23 b3
33 | FOE uu33 vv33 zz33
34 | A vv33 zz33 d3
35 | A uu14 zz14 vv14
36 | L vv14 zz14 b4
37 | A vv24 uu24 zz24
38 | L zz24 vv24 d4
39 | FOE uu34 vv34 zz34
40 | A vv34 zz34 f4
--------------------------------------------------------------------------------
/scripts_and_mol_files/flipper.mol:
--------------------------------------------------------------------------------
1 | FI a 3 b
2 | L b a c
3 | FO c d 2
4 | A d 2 4
5 | FO 4 3 5
--------------------------------------------------------------------------------
/scripts_and_mol_files/foe_bubbles_bit_exp.awk:
--------------------------------------------------------------------------------
1 | BEGIN {
2 |
3 | #
4 | # this file forked from foe_bubbles_09_10.awk owner: chorasimilarity (Marius Buliga, http://chorasimilarity.wordpress.com/ )
5 | #
6 | #
7 | # the goal is to introduce some generic nodes:
8 | # - NOP2 does nothing (in-out ports) (Joshua and Louis asked for it) [is needed a NOP3 with 3 ports? a NOPA, NOPL?]
9 | # - MULIN, has 2 ports, if the in port is free and the out port connects to FO or FOE then is a multiplicator
10 | # - MULOUT, has 2 ports, if the port out is free then it behaves like a TERM
11 | # - PROP has two ports, if the out port connects to FO or FOE then propagates and the FO or FOE becomes FOE
12 | # - DISA is a distributor like A (distributes with FO or FOE and leaves behind two FOE)
13 | # - DISFI is a distributor like FI (distributes with FO only and leaves behind two FO)
14 | # - DISL is a distributor like L (distributes with FO or FOE and leaves behind a FI and a FOE)
15 | # - DISFO is a distributor like FO (distributes with FOE only and leaves behind a FI and a FOE)
16 | #
17 | # the priority of the moves will be the same as the one for the original moves: MULOUT like LOC-PR, MULIN, PROP and DISFO like DIST-FOE (DIST-NEW),
18 | # DISA like DIST-A, DISFI like DIST-FI, DISL like DIST-L.
19 | #
20 |
21 |
22 |
23 | count_lines=0;
24 |
25 | #
26 | # tutext will be eventually the max over ports, so that tutext* will be something which is not the name of an existing port
27 | #
28 | # count_lines will be the number of nodes, so that later count_lines+* will be something which is not the name of an existing node (used for FRIN and FROUT nodes)
29 | #
30 |
31 | tutext="";
32 |
33 | }
34 |
35 | {
36 |
37 | count_lines++;
38 |
39 | #
40 | # node has as argument the node number and as value the node record, as read from the input .mol file
41 | #
42 |
43 | #
44 | #
45 | # for the g-pattern notation see http://chorasimilarity.wordpress.com/2014/07/10/lambda-calculus-and-the-fixed-point-combinator-in-chemlambda-ii/ . To this adds the FRIN AND FROUT nodes (see later)
46 | #
47 | # a .mol file is simply a list of nodes and their ports. Each node is on a line, for example T[a] is written "T a" , Arrow[a,b] is written "Arrow a b" and FO[a,b,c] is written "FO a b c"
48 | #
49 | #
50 |
51 | # if (NR = 0) {exit;}
52 |
53 | # ignores the lines with less than 2 fields
54 |
55 | if (NF > 1) { uu=NR;
56 |
57 | e=$1;
58 |
59 | if ( e !="nuli" ) {
60 | node[uu]=$0;
61 |
62 |
63 | #
64 | # node_type has as argument the node number and as value the node type. later will be added the FRIN and FROUT nodes
65 |
66 | node_type[uu]=$1;
67 |
68 | } }
69 |
70 | if ( NF == 2 ) {
71 |
72 | b=$2;
73 |
74 |
75 | #
76 | # in_port has a port as argument and as value the node which has that port as a "in" port
77 | # count_in has the port as argument and the number of times is a "in" port as value. If count_in[i] > 1 then something is wrong
78 | #
79 | # same for the pair out_port and count_out
80 | #
81 | # here "FROUT" is a free port out, which is seen as a node with one "in" port.
82 | #
83 |
84 |
85 | if ( e == "T" || e == "FROUT" ) { in_port[b]=NR; count_in[b]++; }
86 |
87 |
88 |
89 | # terminal_edge has as argument a port of a "T" node and as value the number of times (can be only 1) the port belongs to a "T" node
90 |
91 | # active_edge has as argument a port which is potentially active and as value the number of times the port appears in one of those positions (so if active_edge[i] == 2 it means that there is potential for a move there
92 |
93 |
94 | if (e == "T" ) {
95 |
96 | terminal_edge[b]++;
97 |
98 | active_edge[b]++;
99 |
100 | }
101 |
102 | #
103 | # likewise, FRIN is a free port in, which is seen as a node with one "out" port
104 | #
105 |
106 | if ( e == "FRIN" ) { out_port[b]=NR; count_out[b]++; }
107 |
108 | #
109 | # used_port has the port as argument and the number of times the port is used as variable
110 | #
111 |
112 | used_port[b]++;
113 |
114 | #
115 | # node_port_i has the number of node as argument and the i'th port as variable
116 | #
117 |
118 | node_port_1[NR]=$2;
119 |
120 | if ( tutext < b ) { tutext=b; }
121 |
122 | }
123 |
124 |
125 | #
126 | # for NF=3 it can be Arrow, NOP2, MULIN, MULOUT, PROP
127 | #
128 |
129 | if ( NF == 3 ) {
130 |
131 | b=$2;
132 |
133 | c=$3;
134 |
135 | if ( tutext < b ) { tutext=b; }
136 |
137 | if (tutext < c) { tutext=c;}
138 |
139 | in_port[b]=NR;
140 |
141 | count_in[b]++;
142 |
143 | used_port[b]++;
144 |
145 | out_port[c]=NR;
146 |
147 | count_out[c]++;
148 |
149 | used_port[c]++;
150 |
151 | node_port_1[NR]=b;
152 |
153 | node_port_2[NR]=c;
154 |
155 | if ( ( e == "MULIN" ) || ( e == "PROP" )) { active_edge[c]++; }
156 |
157 | if ( e == "MULOUT" ) { active_edge[b]++;
158 |
159 | terminal_edge[b]++;
160 |
161 | }
162 | }
163 |
164 | if (NF == 4) { if ( e != "nuli" ) {
165 |
166 | b=$2;
167 |
168 | c=$3;
169 |
170 | d=$4;
171 |
172 |
173 | if ( tutext < b ) { tutext=b; }
174 |
175 | if ( tutext < c ) { tutext=c; }
176 |
177 | if ( tutext < d ) { tutext=d; }
178 |
179 | node_port_1[NR]=b;
180 |
181 | used_port[b]++;
182 |
183 | node_port_2[NR]=c;
184 |
185 | used_port[c]++;
186 |
187 | node_port_3[NR]=d;
188 |
189 | used_port[d]++;
190 |
191 | if ( ( e == "FI" ) || ( e == "DISFI") ) {
192 |
193 |
194 | in_port[b]=NR;
195 |
196 | count_in[b]++;
197 |
198 | in_port[c]=NR;
199 |
200 | count_in[c]++;
201 |
202 | out_port[d]=NR;
203 |
204 | count_out[d]++;
205 |
206 | active_edge[d]++;
207 |
208 | }
209 |
210 | if ( ( e == "A" ) || ( e == "DISA") ) {
211 | in_port[b]=NR;
212 |
213 | count_in[b]++;
214 |
215 | in_port[c]=NR;
216 |
217 | count_in[c]++;
218 |
219 | out_port[d]=NR;
220 |
221 | count_out[d]++;
222 |
223 | active_edge[d]++;
224 |
225 | active_edge[b]++;
226 |
227 | }
228 |
229 |
230 | if ( ( e == "L" ) || ( e == "DISL") ) {
231 |
232 | in_port[b]=NR;
233 |
234 | count_in[b]++;
235 |
236 | out_port[c]=NR;
237 |
238 | count_out[c]++;
239 |
240 | out_port[d]=NR;
241 |
242 | count_out[d]++;
243 |
244 | active_edge[d]++;
245 |
246 | }
247 |
248 | if ( ( e == "FO" ) || ( e == "DISFO") ) {
249 |
250 | in_port[b]=NR;
251 |
252 | count_in[b]++;
253 |
254 | out_port[c]=NR;
255 |
256 | count_out[c]++;
257 |
258 | out_port[d]=NR;
259 |
260 | count_out[d]++;
261 |
262 | active_edge[b]++;
263 |
264 | active_edge[d]++;
265 |
266 | active_edge[c]++;
267 |
268 | # fo_node has as argument the number of a FO node and counts the number of times this node appears (i.e. 1) this is used in the LOC-PR-FO
269 |
270 | fo_node[NR]++;
271 |
272 | }
273 |
274 | #
275 | # FOE node introduced here
276 | #
277 |
278 | if ( e == "FOE" ) {
279 |
280 | in_port[b]=NR;
281 |
282 | count_in[b]++;
283 |
284 | out_port[c]=NR;
285 |
286 | count_out[c]++;
287 |
288 | out_port[d]=NR;
289 |
290 | count_out[d]++;
291 |
292 | active_edge[b]++;
293 |
294 | active_edge[d]++;
295 |
296 | active_edge[c]++;
297 |
298 | # fo_node has as argument the number of a FO node and counts the number of times this node appears (i.e. 1) this is used in the LOC-PR-FO
299 |
300 | fo_node[NR]++;
301 |
302 | }
303 |
304 |
305 | } }
306 |
307 |
308 | }
309 |
310 | END {
311 |
312 | #
313 | # check to see if ports are used more than 2 times. A collection of graphical elements (here called "nodes") with the property that a port variable appears more than 2 times is literarry called a "mess"
314 | #
315 |
316 | count_mess=0;
317 |
318 | for (i in used_port) {
319 |
320 | count_e= used_port[i];
321 |
322 | if (used_port[i] > 2) {
323 |
324 | print "the port " i " is used " used_port[i] " times.";
325 |
326 | count_mess++;
327 |
328 | }
329 | }
330 |
331 | if (count_mess > 0) { print "You have a mess here!"; exit;}
332 |
333 | #
334 | # check to see if a port appears more than once as a "in" port (aso a "mess")
335 | #
336 |
337 | count_double_in=0;
338 |
339 | for (i in count_in ) {
340 |
341 | if ( count_in[i] > 1 ) {
342 |
343 | print "the port " i "is used " count_in[i] " times.";
344 |
345 | count_double_in++;
346 |
347 | }
348 |
349 | }
350 |
351 |
352 |
353 | if (count_double_in > 0 ) { print " You used the same port name for more than one port in.";
354 |
355 | exit;
356 |
357 | }
358 |
359 | #
360 | # check to see if a port appears more than once as a "out" port (a "mess" too)
361 | #
362 |
363 | count_double_out=0;
364 |
365 | for (i in count_out ) {
366 |
367 | if ( count_out[i] > 1 ) {
368 |
369 | print "the port " i "is used " count_out[i] " times.";
370 |
371 | count_double_out++;
372 |
373 | }
374 |
375 | }
376 |
377 | if (count_double_out > 0 ) { print " You used the same port name for more than one port out."; exit; }
378 |
379 | #
380 | # define first edges between nodes, in edge, which takes as argument a port (used twice) and as value the pair of nodes, first being the one where the port appears as an out port
381 | #
382 | # then define the FRIN and FROUT ports by adding them to the arrays node_type, node_port_1, in_port and out_port. Mind that edge still contains only the internal edges
383 | #
384 |
385 | count_new_nodes=0;
386 |
387 | count_max_nodes=count_lines;
388 |
389 | for (i in used_port) { count_e=used_port[i];
390 |
391 | if (count_e == 2) { edge[i]=out_port[i] " " in_port[i]; }
392 |
393 | else { count_new_nodes++;
394 |
395 | if ( i in count_in ) {
396 |
397 | new_node_number=count_lines+count_new_nodes;
398 |
399 | node_type[new_node_number]="FRIN";
400 |
401 | out_port[i]=new_node_number;
402 |
403 | node_port_1[new_node_number]=i;
404 |
405 | node[new_node_number]="FRIN" " " i;
406 |
407 | free_edge[i]=out_port[i] " " in_port[i];
408 |
409 | count_max_nodes=new_node_number;
410 |
411 | active_edge[i]++;
412 |
413 | }
414 |
415 | else {
416 |
417 | new_node_number=count_lines+count_new_nodes;
418 |
419 | node_type[new_node_number]="FROUT";
420 |
421 | in_port[i]=new_node_number;
422 |
423 | node_port_1[new_node_number]=i;
424 |
425 | node[new_node_number]="FROUT" " " i;
426 |
427 | free_edge[i]=out_port[i] " " in_port[i];
428 |
429 | count_max_nodes=new_node_number;
430 |
431 | }
432 |
433 | }
434 |
435 | }
436 |
437 |
438 | #
439 | # count_max_nodes keeps the max nodes number for the moment
440 | #
441 |
442 |
443 |
444 | #
445 | # print what you got until now in temporary files
446 | #
447 |
448 | # first is the internal edges, in file temp_internal_edges_before
449 |
450 | # for (i in edge) { printf(i " " edge[i] "\n") > "temp_internal_edges_before"; }
451 |
452 | #
453 | # the nodes, with numbers in the first column, with FRIN and FROUT nodes too in the file temp_numbered_nodes_before and temp_nodes_before.
454 | #
455 |
456 | #
457 | #
458 | #
459 |
460 |
461 |
462 | for (i in node_type ) {
463 |
464 |
465 | j=node_type[i];
466 |
467 | # printf("node " i " has node type " j " and is: " node[i] "\n");
468 |
469 |
470 | # printf( i " " node[i] "\n") > "temp_numbered_nodes_before"; printf(node[i] "\n") > "temp_nodes_before";
471 |
472 | }
473 |
474 |
475 |
476 | #
477 | # the free in and free out edges in temp_free_edges_before
478 | #
479 |
480 | # for (i in free_edge ) { printf(i " " free_edge[i] "\n") > "temp_free_edges_before"; }
481 |
482 |
483 |
484 |
485 |
486 |
487 | #
488 | # the moves: see http://chorasimilarity.wordpress.com/2014/07/11/lambda-calculus-and-the-fixed-point-combinator-in-chemlambda-iii/
489 | #
490 | #
491 | # count_move_left_node has node ID as argument and counts the number of times a node is in a LEFT pattern for a move
492 | # left_move_left_node had active edge ID as argument and node ID as value, if the node is at left in a LEFT pattern
493 | # left_move_right_node active edge ID as argument and node ID as value, if the node is at right in a LEFT patern
494 | # type_move has active edge ID as argument and the move type as value
495 | # for BETA, FAN-IN, DIST the active edge is the 3-1 edge
496 | # for LOC-PR for A and FI the active edge is the 3-1 edge
497 | # for LOC-PR for L with two T the active edge is the node_port_1[node]
498 | # for LOC-PR for FO with one T the active edge is the other out port of FO
499 | # there is no direct move for FO with two T, the preference is, if any choice, to reduce first the
500 | # move_left has the active edge ID as argument and the LEFT pattern as value
501 | # move_right has the active edge ID as argument and the RIGHT pattern as value
502 | #
503 |
504 | #
505 | # the active edge for MULIN is 2-1
506 | # the active edge for PROP is 2-1
507 | # the active edge for MULOUT is 1 is like for LOC-PR
508 | #
509 | #
510 | #
511 |
512 | # first introduce the counter for the new nodes
513 |
514 | counter_new_nodes=0;
515 |
516 |
517 | for (i in active_edge) {
518 |
519 | if (active_edge[i] == "2") {
520 |
521 | #
522 | # commented definition of ji
523 | # ji=tutext i;
524 | #
525 | u=in_port[i];
526 |
527 | v=out_port[i];
528 |
529 | n_out=node_type[v];
530 |
531 | n_in=node_type[u];
532 |
533 |
534 | # temporary file of active edges temp_edges_active
535 |
536 | # printf(i " " node[v] " " node[u] "\n") > "temp_edges_active";
537 |
538 | # first the check of the moves BETA, FAN-IN, DIST
539 |
540 |
541 |
542 | if (n_out == "L" && n_in == "A") {
543 |
544 | vtry=node_port_3[v];
545 |
546 | utry=node_port_1[u];
547 |
548 | if ( vtry == i && utry == i ) {
549 |
550 | # temporary file of proposed moves, before any priority check
551 |
552 | printf("BETA" " " node[v] " " node[u] " " "REPLACED BY" " " "Arrow" " " node_port_1[v] " " node_port_3[u] " " "Arrow" " " node_port_2[u] " " node_port_2[v] "\n") > "temp_proposed_moves";
553 |
554 | count_move_left_node[v]++;
555 |
556 | count_move_left_node[u]++;
557 |
558 | left_move_left_node[i]=v;
559 |
560 | left_move_right_node[i]=u;
561 |
562 | type_move[i]="BETA";
563 |
564 | # move_left has as argument the active edge and as value the lines of the LEFT pattern
565 |
566 | # move_right has as argument the active edge and as value the lines of the RIGHT pattern
567 |
568 | # for BETA move the active edge is the 3-1 edge
569 |
570 | move_right[i]="Arrow" " " node_port_1[v] " " node_port_3[u] "\n" "Arrow" " " node_port_2[u] " " node_port_2[v] "\n";
571 |
572 | move_left[i]=node[v] "\n" node[u] "\n";
573 |
574 | }}
575 |
576 | # for FAN-IN the active edge is the 3-1 edge
577 | #
578 | # changed FO by FOE
579 | #
580 |
581 | if (n_out == "FI" && n_in == "FOE") {
582 |
583 | vtry=node_port_3[v];
584 |
585 | utry=node_port_1[u];
586 |
587 | if ( vtry == i && utry == i ) {
588 |
589 |
590 | printf("FAN-IN" " " node[v] " " node[u] " " "REPLACED BY" " " "Arrow" " " node_port_1[v] " " node_port_3[u] " " "Arrow" " " node_port_2[v] " " node_port_2[u] "\n") > "temp_proposed_moves";
591 |
592 | count_move_left_node[v]++;
593 |
594 | count_move_left_node[u]++;
595 |
596 | left_move_left_node[i]=v;
597 |
598 | left_move_right_node[i]=u;
599 |
600 | type_move[i]="FAN-IN";
601 |
602 | move_right[i]="Arrow" " " node_port_1[v] " " node_port_3[u] "\n" "Arrow" " " node_port_2[v] " " node_port_2[u] "\n";
603 |
604 | move_left[i]=node[v] "\n" node[u] "\n";
605 |
606 | }}
607 |
608 | # for DIST-L the active edge is the 3-1 edge [DISL move added]
609 | # here we use the system of naming the new ports from the RIGHT pattern of the DIST move by using the trick with the max over ports
610 | #
611 | # added FOE, both DIST-L with FO or FOE are accepted
612 | #
613 |
614 | if (( n_out == "L" || n_out == "DISL" ) && ( n_in == "FO" || n_in == "FOE" ) ) {
615 |
616 |
617 | vtry=node_port_3[v];
618 |
619 | utry=node_port_1[u];
620 |
621 | if ( vtry == i && utry == i ) {
622 |
623 | count_move_left_node[v]++;
624 |
625 | count_move_left_node[u]++;
626 |
627 | left_move_left_node[i]=v;
628 |
629 | left_move_right_node[i]=u;
630 |
631 | type_move[i]="DIST";
632 |
633 | # modified here FO by FOE
634 | #
635 | # new way to count new nodes
636 | #
637 | ca=counter_new_nodes;
638 |
639 | caa=tutext ca;
640 |
641 | counter_new_nodes++;
642 |
643 | cb=counter_new_nodes;
644 |
645 | cbb=tutext cb;
646 |
647 | counter_new_nodes++;
648 |
649 | cc=counter_new_nodes;
650 |
651 | ccc=tutext cc;
652 |
653 | counter_new_nodes++;
654 |
655 |
656 | cd=counter_new_nodes;
657 |
658 | cdd=tutext cd;
659 |
660 | counter_new_nodes++;
661 |
662 |
663 | t_1="FOE" " " node_port_1[v] " " ccc " " cdd;
664 |
665 | t_2="FI" " " cbb " " caa " " node_port_2[v];
666 |
667 | if ( n_out == "L" ) {
668 |
669 |
670 | t_3="L" " " ccc " " caa " " node_port_2[u];
671 |
672 | t_4="L" " " cdd " " cbb " " node_port_3[u]; } else {
673 |
674 | t_3="DISL" " " ccc " " caa " " node_port_2[u];
675 |
676 | t_4="DISL" " " cdd " " cbb " " node_port_3[u]; }
677 |
678 | printf("DIST" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 " " t_4 "\n") > "temp_proposed_moves";
679 |
680 |
681 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" t_4 "\n";
682 |
683 | move_left[i]=node[v] "\n" node[u] "\n";
684 |
685 | }}
686 |
687 | # for DIST-A the active edge is the 3-1 edge
688 | # here we use the system of naming the new ports from the RIGHT pattern of the DIST move by using the trick with the max over ports
689 | #
690 | # DIST-A accepts at left FO or FOE, but at right has only FOE
691 | #
692 | if (( n_out == "A" || n_out == "DISA" ) && ( n_in == "FO" || n_in == "FOE" ) ) {
693 |
694 | vtry=node_port_3[v];
695 |
696 | utry=node_port_1[u];
697 |
698 | if ( vtry == i && utry == i ) {
699 |
700 |
701 | count_move_left_node[v]++;
702 |
703 | count_move_left_node[u]++;
704 |
705 | left_move_left_node[i]=v;
706 |
707 | left_move_right_node[i]=u;
708 |
709 | type_move[i]="DIST";
710 |
711 | ca=counter_new_nodes;
712 |
713 | caa=tutext ca;
714 |
715 | counter_new_nodes++;
716 |
717 | cb=counter_new_nodes;
718 |
719 | cbb=tutext cb;
720 |
721 | counter_new_nodes++;
722 |
723 | cc=counter_new_nodes;
724 |
725 | ccc=tutext cc;
726 |
727 | counter_new_nodes++;
728 |
729 |
730 | cd=counter_new_nodes;
731 |
732 | cdd=tutext cd;
733 |
734 | counter_new_nodes++;
735 |
736 | t_1="FOE" " " node_port_1[v] " " caa " " cbb;
737 |
738 | t_2="FOE" " " node_port_2[v] " " ccc " " cdd;
739 |
740 | if ( n_out == "A" ) {
741 |
742 | t_3="A" " " caa " " ccc " " node_port_2[u];
743 |
744 | t_4="A" " " cbb " " cdd " " node_port_3[u]; } else {
745 |
746 | t_3="DISA" " " caa " " ccc " " node_port_2[u];
747 |
748 | t_4="DISA" " " cbb " " cdd " " node_port_3[u]; }
749 |
750 | printf("DIST" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 " " t_4 "\n") > "temp_proposed_moves";
751 |
752 |
753 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" t_4 "\n";
754 |
755 | move_left[i]=node[v] "\n" node[u] "\n";
756 |
757 | }}
758 |
759 | # for DIST-FI the active edge is the 3-1 edge
760 | # here we use the system of naming the new ports from the RIGHT pattern of the DIST move by using the trick with the max over ports
761 | #
762 | # DIST-A accepts at left FO, not FOE, and at right has only FO
763 | #
764 | if (( n_out == "FI" || n_out == "DISFI" ) && n_in == "FO" ) {
765 |
766 | vtry=node_port_3[v];
767 |
768 | utry=node_port_1[u];
769 |
770 | if ( vtry == i && utry == i ) {
771 |
772 | count_move_left_node[v]++;
773 |
774 | count_move_left_node[u]++;
775 |
776 | left_move_left_node[i]=v;
777 |
778 | left_move_right_node[i]=u;
779 |
780 | type_move[i]="DIST";
781 |
782 | ca=counter_new_nodes;
783 |
784 | caa=tutext ca;
785 |
786 | counter_new_nodes++;
787 |
788 | cb=counter_new_nodes;
789 |
790 | cbb=tutext cb;
791 |
792 | counter_new_nodes++;
793 |
794 | cc=counter_new_nodes;
795 |
796 | ccc=tutext cc;
797 |
798 | counter_new_nodes++;
799 |
800 |
801 | cd=counter_new_nodes;
802 |
803 | cdd=tutext cd;
804 |
805 | counter_new_nodes++;
806 |
807 | t_1="FO" " " node_port_1[v] " " caa " " cbb;
808 |
809 | t_2="FO" " " node_port_2[v] " " ccc " " cdd;
810 |
811 | if ( n_out == "FI" ) {
812 |
813 | t_3="FI" " " caa " " ccc " " node_port_2[u];
814 |
815 | t_4="FI" " " cbb " " cdd " " node_port_3[u]; } else {
816 |
817 | t_3="DISFI" " " caa " " ccc " " node_port_2[u];
818 |
819 | t_4="DISFI" " " cbb " " cdd " " node_port_3[u]; }
820 |
821 | printf("DIST" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 " " t_4 "\n") > "temp_proposed_moves";
822 |
823 |
824 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" t_4 "\n";
825 |
826 | move_left[i]=node[v] "\n" node[u] "\n";
827 |
828 | }}
829 |
830 |
831 | # for DIST-FOE the active edge is the 3-1 edge
832 | # here we use the system of naming the new ports from the RIGHT pattern of the DIST move by using the trick with the max over ports
833 | #
834 | #
835 | #
836 |
837 | if (( n_out == "FO" || n_out == "DISFO" ) && n_in == "FOE" ) {
838 |
839 | vtry=node_port_3[v];
840 |
841 | utry=node_port_1[u];
842 |
843 | if ( vtry == i && utry == i ) {
844 |
845 | count_move_left_node[v]++;
846 |
847 | count_move_left_node[u]++;
848 |
849 | left_move_left_node[i]=v;
850 |
851 | left_move_right_node[i]=u;
852 |
853 | type_move[i]="DIST-NEW";
854 |
855 | ca=counter_new_nodes;
856 |
857 | caa=tutext ca;
858 |
859 | counter_new_nodes++;
860 |
861 | cb=counter_new_nodes;
862 |
863 | cbb=tutext cb;
864 |
865 | counter_new_nodes++;
866 |
867 | cc=counter_new_nodes;
868 |
869 | ccc=tutext cc;
870 |
871 | counter_new_nodes++;
872 |
873 |
874 | cd=counter_new_nodes;
875 |
876 | cdd=tutext cd;
877 |
878 | counter_new_nodes++;
879 |
880 |
881 | # modified here FO by FOE
882 | t_1="FOE" " " node_port_1[v] " " ccc " " cdd;
883 |
884 | t_2="FI" " " cbb " " caa " " node_port_2[v];
885 |
886 | if (n_out == "FO" ) {
887 |
888 | t_3="FO" " " ccc " " caa " " node_port_2[u];
889 |
890 | t_4="FO" " " cdd " " cbb " " node_port_3[u]; } else {
891 |
892 |
893 | t_3="DISFO" " " ccc " " caa " " node_port_2[u];
894 |
895 | t_4="DISFO" " " cdd " " cbb " " node_port_3[u]; }
896 |
897 |
898 | printf("DIST" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 " " t_4 "\n") > "temp_proposed_moves";
899 |
900 |
901 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" t_4 "\n";
902 |
903 | move_left[i]=node[v] "\n" node[u] "\n";
904 |
905 | }}
906 | # the moves PROP and MULIN
907 |
908 |
909 | if (( n_out == "PROP" || n_out == "MULIN" ) && ( n_in == "FOE" || n_in == "FO") ) {
910 |
911 | vtry=node_port_2[v];
912 |
913 | utry=node_port_1[u];
914 |
915 | if ( vtry == i && utry == i ) {
916 |
917 | count_move_left_node[v]++;
918 |
919 | count_move_left_node[u]++;
920 |
921 | left_move_left_node[i]=v;
922 |
923 | left_move_right_node[i]=u;
924 |
925 | type_move[i]="DIST-NEW";
926 |
927 | ca=counter_new_nodes;
928 |
929 | caa=tutext ca;
930 |
931 | counter_new_nodes++;
932 |
933 | cb=counter_new_nodes;
934 |
935 | cbb=tutext cb;
936 |
937 | counter_new_nodes++;
938 |
939 |
940 |
941 |
942 | #
943 | t_1="FOE" " " node_port_1[v] " " caa " " cbb;
944 |
945 |
946 | t_2= n_out " " caa " " node_port_2[u];
947 |
948 | t_3= n_out " " cbb " " node_port_3[u];
949 |
950 |
951 | printf("DIST" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 " " t_4 "\n") > "temp_proposed_moves";
952 |
953 |
954 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" ;
955 |
956 | move_left[i]=node[v] "\n" node[u] "\n";
957 |
958 | }}
959 |
960 | # the move MULIN-MULOUT
961 |
962 | if ( n_out == "MULIN" && n_in == "MULOUT" ) {
963 |
964 |
965 | count_move_left_node[v]++;
966 |
967 | count_move_left_node[u]++;
968 |
969 | left_move_left_node[i]=v;
970 |
971 | left_move_right_node[i]=u;
972 |
973 | type_move[i]="MULINMULOUT";
974 |
975 | t_1="Arrow" " " node_port_1[v] " " node_port_2[u];
976 |
977 | printf("FRIN" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 "\n") > "temp_proposed_moves";
978 |
979 |
980 | move_right[i]=t_1 "\n";
981 |
982 | move_left[i]=node[v] "\n" node[u] "\n";
983 |
984 | }
985 |
986 | # the move FRIN [COMMENTED]
987 |
988 |
989 |
990 | # if ( n_out == "FRIN" && ( n_in == "FOE" || n_in == "FO") ) {
991 |
992 | # vtry=node_port_1[v];
993 |
994 | # utry=node_port_1[u];
995 |
996 | # if ( vtry == i && utry == i ) {
997 |
998 | # count_move_left_node[v]++;
999 |
1000 | # count_move_left_node[u]++;
1001 |
1002 | # left_move_left_node[i]=v;
1003 |
1004 | # left_move_right_node[i]=u;
1005 |
1006 | # type_move[i]="FRIN";
1007 |
1008 | # ca=counter_new_nodes;
1009 |
1010 | # caa=tutext ca;
1011 |
1012 | # counter_new_nodes++;
1013 |
1014 | # cb=counter_new_nodes;
1015 |
1016 | # cbb=tutext cb;
1017 |
1018 | # counter_new_nodes++;
1019 |
1020 |
1021 |
1022 |
1023 | #
1024 | # t_1="FOE" " " node_port_1[v] " " caa " " cbb;
1025 |
1026 |
1027 | # t_2= "MULOUT" " " caa " " node_port_2[u];
1028 |
1029 | # t_3= "MULOUT" " " cbb " " node_port_3[u];
1030 |
1031 |
1032 | # printf("FRIN" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 "\n") > "temp_proposed_moves";
1033 |
1034 |
1035 | # move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" ;
1036 |
1037 | # move_left[i]=node[v] "\n" node[u] "\n";
1038 |
1039 | # }}
1040 |
1041 |
1042 |
1043 |
1044 | # now the clear moves LOC-PR, for A and FI
1045 |
1046 |
1047 |
1048 | if (n_out == "A" && n_in == "T") {
1049 |
1050 | count_move_left_node[v]++;
1051 |
1052 | count_move_left_node[u]++;
1053 |
1054 | left_move_left_node[i]=v;
1055 |
1056 | left_move_right_node[i]=u;
1057 |
1058 | type_move[i]="LOC-PR";
1059 |
1060 | # for LOC-PR-A and LOC-PR-FI the active edge is the 3 port of A or FI
1061 |
1062 | move_right[i]="T" " " node_port_1[v] "\n" "T" " " node_port_2[v] "\n";
1063 |
1064 | move_left[i]=node[v] "\n" node[u] "\n";
1065 |
1066 | printf("LOC-PR" " " node[v] " " node[u] " " "REPLACED BY" " " "T" " " node_port_1[v] " " "T" " " node_port_2[v] "\n") > "temp_proposed_moves";
1067 |
1068 | }
1069 |
1070 |
1071 | if (n_out == "FI" && n_in == "T") {
1072 |
1073 | count_move_left_node[v]++;
1074 |
1075 | count_move_left_node[u]++;
1076 |
1077 | left_move_left_node[i]=v;
1078 |
1079 | left_move_right_node[i]=u;
1080 |
1081 | type_move[i]="LOC-PR";
1082 |
1083 | move_right[i]="T" " " node_port_1[v] "\n" "T" " " node_port_2[v] "\n";
1084 |
1085 | move_left[i]=node[v] "\n" node[u] "\n";
1086 |
1087 | printf("LOC-PR" " " node[v] " " node[u] " " "REPLACED BY" " " "T" " " node_port_1[v] " " "T" " " node_port_2[v] "\n") > "temp_proposed_moves";
1088 |
1089 | }
1090 |
1091 | ## the MULOUT FOR A AND FI
1092 |
1093 |
1094 | if (( n_out == "A" || n_out == "FI" ) && n_in == "MULOUT") {
1095 |
1096 | count_move_left_node[v]++;
1097 |
1098 | count_move_left_node[u]++;
1099 |
1100 | left_move_left_node[i]=v;
1101 |
1102 | left_move_right_node[i]=u;
1103 |
1104 | type_move[i]="LOC-PR";
1105 |
1106 | # for LOC-PR-A and LOC-PR-FI the active edge is the 3 port of A or FI
1107 |
1108 |
1109 | ##########
1110 |
1111 | ca=counter_new_nodes;
1112 |
1113 | caa=tutext ca;
1114 |
1115 | counter_new_nodes++;
1116 |
1117 | cb=counter_new_nodes;
1118 |
1119 | cbb=tutext cb;
1120 |
1121 | counter_new_nodes++;
1122 |
1123 |
1124 |
1125 |
1126 | #
1127 | t_1= n_out " " caa " " cbb " " node_port_2[u];
1128 |
1129 | t_2= "MULOUT" " " node_port_1[v] " " caa;
1130 |
1131 | t_3= "MULOUT" " " node_port_2[v] " " cbb ;
1132 |
1133 |
1134 | printf("MULOUT" " " node[v] " " node[u] " " "REPLACED BY" " " t_1 " " t_2 " " t_3 "\n") > "temp_proposed_moves";
1135 |
1136 |
1137 | move_right[i]=t_1 "\n" t_2 "\n" t_3 "\n" ;
1138 |
1139 | move_left[i]=node[v] "\n" node[u] "\n";
1140 |
1141 |
1142 |
1143 | }
1144 |
1145 |
1146 | ## NOT YET DONE FOR MULOUT AND L
1147 |
1148 |
1149 | # the move LOC-PR for L
1150 |
1151 | if (n_out == "L" && ( n_in == "T" || n_in=="MULOUT")) {
1152 |
1153 | ww=node_port_2[v];
1154 |
1155 | if (ww in terminal_edge) {
1156 |
1157 | # BIG PROBLEM HERE: port is declared as node!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Corrected!
1158 |
1159 | left_move_left_node[v]=v;
1160 |
1161 | type_move[node_port_1[v]]="LOC-PR";
1162 |
1163 |
1164 | # for LOC-PR-L the active edge is the port 1 of L
1165 |
1166 | move_right[node_port_1[v]]=n_in " " node_port_1[v] "\n";
1167 |
1168 | move_left[node_port_1[v]]=node[v] "\n" node[u] "\n" "T" " " ww;
1169 |
1170 | printf("LOC-PR" " " node[v] " " node[u] " " "T" " " ww " " "REPLACED BY" " " n_in " " node_port_1[v] "\n") > "temp_proposed_moves";
1171 |
1172 | }
1173 |
1174 | }
1175 |
1176 |
1177 |
1178 | }
1179 | }
1180 |
1181 |
1182 |
1183 |
1184 |
1185 | # the move LOC-PR for FO. attention! there is no LOC-PR-FO with two T nodes simultaneously. The preference is towards the node_port_2 for such a move. Remark that the FO is replaced by an Arrow!
1186 | #
1187 | # added LOC-PR for FOE
1188 | #
1189 |
1190 | for (j in fo_node) {
1191 |
1192 | np_2=node_port_2[j];
1193 |
1194 | np_3=node_port_3[j];
1195 |
1196 | np_np_2=in_port[np_2]; np_np_2_type=node_type[np_np_2];
1197 |
1198 | np_np_3=in_port[np_3]; np_np_3_type=node_type[np_np_3];
1199 |
1200 | if (np_np_2_type == "T") {
1201 |
1202 |
1203 | count_move_left_node[j]++;
1204 |
1205 | count_move_left_node[no_np_2]++;
1206 |
1207 | left_move_left_node[np_2]=j;
1208 | # for LOC-PR-FO as described the active edge is node_port_2, in case there is a "T" there
1209 |
1210 | type_move[np_2]="LOC-PR";
1211 |
1212 | move_right[np_2]="Arrow" " " node_port_1[j] " " node_port_3[j] "\n";
1213 |
1214 | move_left[np_2]=node[j] "\n" node[np_np_2] "\n";
1215 |
1216 | printf("LOC-PR" " " node[j] " " node[np_np_2] " " "REPLACED BY" " " "Arrow" " " node_port_1[j] " " node_port_3[j] "\n") > "temp_proposed_moves";
1217 |
1218 |
1219 |
1220 |
1221 | } else {
1222 |
1223 | if (np_np_3_type == "T") {
1224 |
1225 | count_move_left_node[j]++;
1226 | count_move_left_node[np_np_3]++;
1227 | ##################################################################################################
1228 | left_move_left_node[np_3]=j;
1229 |
1230 | # ... otherwise for LOC-PR-FO as described the active edge is node_port_3, in case there is a "T" there but not at node_port_2
1231 |
1232 | type_move[np_3]="LOC-PR";
1233 |
1234 | move_right[np_3]="Arrow" " " node_port_1[j] " " node_port_2[j] "\n";
1235 |
1236 | move_left[np_3]=node[j] "\n" node[np_np_3] "\n";
1237 |
1238 | printf("LOC-PR" " " node[j] " " node[np_np_3] " " "REPLACED BY" " " "Arrow" " " node_port_1[j] " " node_port_2[j] "\n") > "temp_proposed_moves";
1239 |
1240 | }
1241 |
1242 | }
1243 | }
1244 |
1245 |
1246 |
1247 |
1248 | # check for PRIORITY CHOICE "VIRAL- DISCRETE".
1249 | #
1250 | # the priority choice works by first removing anything which competes with DIST-FOE (i.e. "DIST-NEW"), then apply the viral priority choice on the remaining moves. That's why the move_left is traversed twice
1251 | #
1252 |
1253 | # first traversal of move_left, exclusively for detecting DIST-NEW
1254 |
1255 |
1256 | for ( k in move_left) {
1257 |
1258 | tu=type_move[k];
1259 |
1260 | coco_left=left_move_left_node[k];
1261 |
1262 | coocoo_left=node_type[coco];
1263 |
1264 | cucu_left=count_move_left_node[coco];
1265 |
1266 |
1267 | if ( tu == "DIST-NEW" ) {
1268 |
1269 | dudu_left_1=node_port_1[coco_left];
1270 |
1271 | if (dudu_left_1 in move_left ) {
1272 |
1273 | coco_left_left=left_move_left_node[dudu_left_1];
1274 |
1275 | count_move_left_node[coco_left_left]--;
1276 |
1277 | printf("DIST-NEW deleted 1st traversal " move_right[dudu_left_1] "\n") > "temp_del_moves";
1278 | delete move_left[dudu_left_1]; delete move_right[dudu_left_1];}}
1279 |
1280 |
1281 |
1282 |
1283 | }
1284 |
1285 | # second traversal, as usual for viral choice
1286 |
1287 |
1288 | for ( k in move_left) {
1289 |
1290 | tu=type_move[k];
1291 |
1292 | coco=left_move_left_node[k];
1293 |
1294 | coocoo=node_type[coco];
1295 |
1296 | cucu=count_move_left_node[coco];
1297 |
1298 | if (tu == "LOC-PR" && cucu > 1) {
1299 | printf("LOC-PR deleted 1st traversal " move_right[k] "\n") > "temp_del_moves";
1300 | delete move_left[k]; delete move_right[k]; }
1301 |
1302 | # if (tu == "DIST-NEW" && cucu == 2 ) {
1303 |
1304 | # printf("DIST-NEW deleted 2nd traversal " move_right[k] "\n") > "temp_del_moves";
1305 | # delete move_left[k]; delete move_right[k];}
1306 |
1307 | if (tu == "DIST" && cucu == 2 && coocoo == "A") {
1308 |
1309 | printf("DIST-NEW deleted 2nd traversal " move_right[dudu] "\n") > "temp_del_moves";
1310 | dudu=node_port_1[coco] ; delete move_left[dudu]; delete move_right[dudu]; }
1311 |
1312 |
1313 |
1314 | }
1315 |
1316 | for ( ik in move_left ) { printf(move_left[ik]) > "temp_trashed_nodes"; printf(move_right[ik]) > "temp_added_nodes";
1317 |
1318 | }
1319 |
1320 |
1321 |
1322 | #
1323 | # removes the nodes from move_left from node array
1324 | #
1325 |
1326 |
1327 |
1328 | for ( i in node ) { j=node[i]; occ[j]=i;}
1329 |
1330 |
1331 |
1332 | susu="\n";
1333 |
1334 | for ( i in move_left ) {
1335 |
1336 | lulu=move_left[i];
1337 |
1338 | delete tem;
1339 |
1340 | nunu=split(lulu,tem,susu);
1341 |
1342 | for (j in tem ) {
1343 |
1344 | s=tem[j];
1345 |
1346 | if ( s in occ ) {
1347 |
1348 | ss=occ[s]; delete node[ss];
1349 |
1350 | }
1351 |
1352 | }
1353 |
1354 | delete tem;
1355 |
1356 | }
1357 |
1358 |
1359 |
1360 | #
1361 | # adds then nodes from move_right to node array
1362 | #
1363 | # we use count_max_nodes here
1364 | #
1365 |
1366 |
1367 |
1368 |
1369 | for (i in move_right ) {
1370 |
1371 | lili=move_right[i];
1372 |
1373 | delete tem;
1374 |
1375 | susu="\n";
1376 |
1377 | nene=split(lili,tem,susu);
1378 |
1379 | if (nene > 1) {
1380 |
1381 | for (h=1; h "temp_inter_nodes"; }
1396 |
1397 | #
1398 | # identifies the node ports and edges
1399 | #
1400 |
1401 |
1402 | for (i in inter_node ) {
1403 |
1404 | lolo=inter_node[i];
1405 |
1406 | delete tem;
1407 |
1408 | susu=" ";
1409 |
1410 | nana=split(lolo,tem,susu);
1411 |
1412 |
1413 | if (nana == 2 ) { u=tem[1]; v=tem[2];
1414 |
1415 | inter_node_type[i]=u;
1416 |
1417 | inter_node_port_1[i]=v;
1418 |
1419 | if ( u == "FRIN" ) { inter_out_port[v]=i; is_not_arrow[i]++; } else { inter_in_port[v]=i;}
1420 |
1421 | }
1422 |
1423 | if (nana == 3 ) { u=tem[1]; v=tem[2]; w=tem[3];
1424 |
1425 | inter_node_type[i]=u;
1426 |
1427 | inter_node_port_1[i]=v;
1428 |
1429 | inter_node_port_2[i]=w;
1430 |
1431 | inter_in_port[v]=i;
1432 |
1433 | inter_out_port[w]=i;
1434 |
1435 | if ( u == "Arrow" ) { is_arrow[v]++; } else {is_not_arrow[i]++;}
1436 |
1437 |
1438 |
1439 | }
1440 |
1441 | if (nana == 4 ) { u=tem[1]; v=tem[2]; w=tem[3]; z=tem[4];
1442 |
1443 | is_not_arrow[i]++;
1444 |
1445 | inter_node_type[i]=u;
1446 |
1447 | inter_node_port_1[i]=v;
1448 |
1449 | inter_in_port[v]=i;
1450 |
1451 | inter_node_port_2[i]=w;
1452 |
1453 | inter_node_port_3[i]=z;
1454 |
1455 | inter_out_port[z]=i;
1456 |
1457 | if ( ( u == "A" ) || ( u == "FI" ) || ( u == "DISA" ) || ( u == "DISFI") ) { inter_in_port[w]=i; } else { inter_out_port[w]=i; }
1458 |
1459 |
1460 | }
1461 |
1462 |
1463 | }
1464 |
1465 |
1466 | # for ( i in is_arrow ) { arroin=inter_out_port[i]; arro=inter_in_port[i]; z=inter_node_port_2[arro]; arroout=inter_in_port[z];
1467 | # arroin_type=inter_node_type[arroin]; printf(is_arrow[i] " , " "node " inter_node[arroin] " has type " arroin_type " and links to " inter_node[arro] " who links to " inter_node[arroout] "\n"); }
1468 | # for (i in is_not_arrow ) {printf( inter_node[i] "\n");}
1469 |
1470 |
1471 | #
1472 | # the graph before COMB moves
1473 | #
1474 |
1475 | for ( i in inter_node ) { lele=length(inter_node[i]); if ( lele > 0 ) { printf(inter_node[i] "\n") > "temp_before_comb";} }
1476 |
1477 |
1478 |
1479 | #
1480 | # the COMB MOVES loop
1481 | #
1482 | count_arrow_del=1;
1483 |
1484 | while (count_arrow_del > 0 ) {
1485 |
1486 | count_arrow_del=0;
1487 |
1488 |
1489 |
1490 | for ( i in is_arrow ) { if ( is_arrow[i] > 0 ) { arroin=inter_out_port[i]; arro=inter_in_port[i]; z=inter_node_port_2[arro]; arroout=inter_in_port[z];
1491 |
1492 | if ( arroin in is_not_arrow ) { arroin_type=inter_node_type[arroin];
1493 |
1494 | if (arroin_type == "FRIN" ) {
1495 |
1496 | inter_node_port_1[arroin]=z;
1497 |
1498 | delete inter_node[arro];
1499 |
1500 | inter_out_port[z]=arroin;
1501 |
1502 | inter_in_port[z]=arroout;
1503 |
1504 | count_arrow_del++;
1505 |
1506 | is_arrow[i]--;
1507 |
1508 | }
1509 |
1510 | ##########################################################################################################################################
1511 |
1512 |
1513 | if (arroin_type == "NOP2" || arroin_type == "MULIN" || arroin_type == "MULOUT" || arroin_type == "PROP" ) {
1514 |
1515 | inter_node_port_2[arroin]=z;
1516 |
1517 | delete inter_node[arro];
1518 |
1519 | inter_out_port[z]=arroin;
1520 |
1521 | inter_in_port[z]=arroout;
1522 |
1523 | count_arrow_del++;
1524 |
1525 | is_arrow[i]--;
1526 |
1527 | }
1528 |
1529 |
1530 | ##########################################################################################################################################
1531 |
1532 |
1533 | if (arroin_type == "A" || arroin_type == "FI" || arroin_type == "DISA" || arroin_type == "DISFI" ) {
1534 |
1535 | inter_node_port_3[arroin]=z;
1536 |
1537 | delete inter_node[arro];
1538 |
1539 | inter_out_port[z]=arroin;
1540 |
1541 | inter_in_port[z]=arroout;
1542 |
1543 | count_arrow_del++;
1544 |
1545 | is_arrow[i]--;
1546 |
1547 | }
1548 |
1549 | if (arroin_type == "L" || arroin_type == "FO" || arroin_type == "FOE" || arroin_type == "DISL" ) {
1550 |
1551 | u=inter_node_port_2[arroin];
1552 |
1553 | v=inter_node_port_3[arroin];
1554 |
1555 | delete inter_node[arro];
1556 |
1557 | if ( u == i ) { inter_node_port_2[arroin]=z; } else { inter_node_port_3[arroin]=z; }
1558 |
1559 | inter_out_port[z]=arroin;
1560 |
1561 | inter_in_port[z]=arroout;
1562 |
1563 | count_arrow_del++;
1564 |
1565 | is_arrow[i]--;
1566 |
1567 | }
1568 |
1569 |
1570 | }
1571 |
1572 |
1573 |
1574 |
1575 |
1576 |
1577 | } }
1578 |
1579 | }
1580 |
1581 | #
1582 | # removes all other arrow element, because they make loops
1583 | #
1584 |
1585 |
1586 |
1587 | for (i in inter_node ) { zuzu=inter_node_type[i];
1588 |
1589 | # if ( zuzu == "Arrow" ) { delete inter_node[i]; }
1590 |
1591 | if (zuzu == "FRIN" || zuzu == "FROUT" || zuzu == "T" ) { inter_node[i]=zuzu " " inter_node_port_1[i]; }
1592 |
1593 | if (zuzu == "PROP" || zuzu == "MULOUT" || zuzu == "MULIN" || zuzu == "NOP2" ) { inter_node[i]=zuzu " " inter_node_port_1[i] " " inter_node_port_2[i]; }
1594 |
1595 |
1596 |
1597 | if (zuzu == "A" || zuzu == "L" || zuzu == "FI" || zuzu == "FO" || zuzu == "FOE" || zuzu == "DISA" || zuzu == "DISL" || zuzu == "DISFO" || zuzu == "DISFI" ) { inter_node[i]=zuzu " " inter_node_port_1[i] " " inter_node_port_2[i] " " inter_node_port_3[i]; }
1598 |
1599 | }
1600 |
1601 |
1602 | #
1603 | # print final list of nodes
1604 | #
1605 | conode=0;
1606 |
1607 | for ( i in inter_node ) { lele=length(inter_node[i]); if ( lele > 0 ) { printf(inter_node[i] "\n") > "temp_final_nodes";
1608 |
1609 | zeze=inter_node_type[i]; if (zeze != "Arrow" ) {conode++;}
1610 |
1611 | }}
1612 |
1613 | printf(conode) > "temp_for_count";
1614 |
1615 |
1616 |
1617 |
1618 |
1619 | ####################################################################
1620 |
1621 | }
1622 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/foetape.mol:
--------------------------------------------------------------------------------
1 | FOE a out 1r
2 | FOE 1r 1 2r
3 | FOE 2r 2 3r
4 | FOE 3r 3 4r
5 | FOE 4r 4 5
6 | FI 1l 1 b
7 | FI 2l 2 1l
8 | FI 3l 3 2l
9 | FI 4l 4 3l
10 | FI in 5 4l
11 | FO out dd 22
12 | A dd 22 a
--------------------------------------------------------------------------------
/scripts_and_mol_files/gen_check_1_foe.awk:
--------------------------------------------------------------------------------
1 | BEGIN {
2 |
3 | # forked from check_1_foe.awk version 06.10.2014
4 | #
5 | # this program reads a .mol file and produces the json. version 29.09.2014. owner: chorasimilarity (Marius Buliga, http://chorasimilarity.wordpress.com/ )
6 | #
7 | # but it makes invisible the active edges!
8 | #
9 |
10 | main_const=4;
11 |
12 | gen_const=8;
13 |
14 | left=2;
15 |
16 | right=1;
17 |
18 | middle=1;
19 |
20 | green_col="#04B431";
21 |
22 | red_col="#FF0000";
23 |
24 | in_col="#FFFF00";
25 |
26 | out_col="#2E2EFE";
27 |
28 | bond_int=2;
29 |
30 | bond_ext=1;
31 |
32 | term_col="#7F8C8D";
33 |
34 | arrow_col="#ECF0F1";
35 |
36 | prop_col="#8E44AD";
37 |
38 | nop_col="#95A5A6";
39 |
40 |
41 |
42 | count_lines=0;
43 |
44 | }
45 |
46 | {
47 |
48 |
49 | #
50 | # node has as argument the node number and as value the node record, as read from the input .mol file
51 | #
52 |
53 |
54 | #
55 | # a .mol file is simply a list of nodes and their ports. Each node is on a line, for example T[a] is written "T a" , Arrow[a,b] is written "Arrow a b" and FO[a,b,c] is written "FO a b c"
56 | #
57 | #
58 |
59 |
60 |
61 | # ignores the lines with less than 2 fields (no loop element)
62 |
63 | if (NF == 2) {
64 |
65 | node[NR]=$0; node_type[NR]=$1;
66 |
67 | node_port_1[NR]=$2;
68 |
69 | b=$2;
70 |
71 | }
72 |
73 |
74 | #
75 | # node_type has as argument the node number and as value the node type.
76 |
77 | if ( NF == 3 ) { node_type[NR]=$1; node[NR]=$0;
78 |
79 | node_port_1[NR]=$2;
80 |
81 | node_port_2[NR]=$3;}
82 |
83 | if (NF == 4) { node_port_1[NR]=$2; node[NR]=$0; node_type[NR]=$1;
84 |
85 | node_port_2[NR]=$3; node_port_3[NR]=$4; }
86 |
87 |
88 | }
89 |
90 | END {
91 |
92 |
93 |
94 | #
95 | # a bijective function between the id of the nodes and the number (from json file)
96 | #
97 |
98 | j=0;
99 |
100 | for ( i in node) {
101 |
102 | nu_node[i]=j;
103 | node_nu[j]=i;
104 | s=node_type[i];
105 | if (s == "A" || s == "DISA") { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
106 | used_port_i[a]++;
107 | used_port_i[b]++;
108 | used_port_i[c]++;
109 | used_port[a]++;
110 | used_port[b]++;
111 | used_port[c]++;
112 | # active ports
113 | # active_port[c]++;
114 | # active_port[a]++;
115 | #
116 | all_node_text[j]=s;
117 | if (s == "A" ) { all_node_size[j]=main_const; } else { all_node_size[j]=gen_const;}
118 | all_node_colour[j]=green_col;
119 | all_edge_target[a]=j+1; all_edge_target[b]=j+2; all_edge_source[c]=j+3;
120 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
121 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
122 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
123 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
124 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
125 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
126 | j++;
127 | # all_node_text[j]="port_1" zu;
128 | all_node_text[j]=a;
129 | all_node_size[j]=left;
130 | all_node_colour[j]=in_col;
131 | j++;
132 | # all_node_text[j]="port_2" zu;
133 | all_node_text[j]=b;
134 | all_node_size[j]=right;
135 | all_node_colour[j]=in_col;
136 | j++;
137 | # all_node_text[j]="port_3" zu;
138 | all_node_text[j]=c;
139 | all_node_size[j]=middle;
140 | all_node_colour[j]=out_col;
141 | }
142 | if (s == "FI" || s == "DISFI" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
143 | used_port_i[a]++;
144 | used_port_i[b]++;
145 | used_port_i[c]++;
146 | used_port[a]++;
147 | used_port[b]++;
148 | used_port[c]++;
149 | # active port
150 | # active_port[c]++;
151 | #
152 | all_node_text[j]=s;
153 | if (s == "FI" ) { all_node_size[j]=main_const; } else { all_node_size[j]=gen_const;}
154 | all_node_colour[j]=red_col;
155 | all_edge_target[a]=j+1; all_edge_target[b]=j+2; all_edge_source[c]=j+3;
156 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
157 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
158 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
159 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
160 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
161 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
162 | j++;
163 | # all_node_text[j]="port_1" zu;
164 | all_node_text[j]=a;
165 | all_node_size[j]=left;
166 | all_node_colour[j]=in_col;
167 | j++;
168 | # all_node_text[j]="port_2" zu;
169 | all_node_text[j]=b;
170 | all_node_size[j]=right;
171 | all_node_colour[j]=in_col;
172 | j++;
173 | # all_node_text[j]="port_3" zu;
174 | all_node_text[j]=c;
175 | all_node_size[j]=middle;
176 | all_node_colour[j]=out_col;
177 | }
178 | if (s == "L" || s == "DISL" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
179 | used_port_i[a]++;
180 | used_port_i[b]++;
181 | used_port_i[c]++;
182 | used_port[a]++;
183 | used_port[b]++;
184 | used_port[c]++;
185 | # active port
186 | # active_port[c]++;
187 | #
188 | all_node_text[j]=s;
189 | if (s == "L" ) { all_node_size[j]=main_const; } else { all_node_size[j]=gen_const;}
190 | all_node_colour[j]=red_col;
191 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
192 |
193 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
194 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
195 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
196 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
197 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
198 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
199 |
200 | j++;
201 | # all_node_text[j]="port_1" zu;
202 | all_node_text[j]=a;
203 | all_node_size[j]=middle;
204 | all_node_colour[j]=in_col;
205 | j++;
206 | # all_node_text[j]="port_2" zu;
207 | all_node_text[j]=b;
208 | all_node_size[j]=left;
209 | all_node_colour[j]=out_col;
210 | j++;
211 | # all_node_text[j]="port_3" zu;
212 | all_node_text[j]=c;
213 | all_node_size[j]=right;
214 | all_node_colour[j]=out_col;
215 | }
216 | if (s == "FO" || s == "DISFO" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
217 | used_port_i[a]++;
218 | used_port_i[b]++;
219 | used_port_i[c]++;
220 | used_port[a]++;
221 | used_port[b]++;
222 | used_port[c]++;
223 | # active ports
224 | # active_port[a]++;
225 | # active_port[b]++;
226 | # active_port[c]++;
227 | #
228 | all_node_text[j]=s;
229 | if (s == "FO" ) { all_node_size[j]=main_const; } else { all_node_size[j]=gen_const;}
230 | all_node_colour[j]=green_col;
231 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
232 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
233 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
234 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
235 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
236 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
237 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
238 | j++;
239 | # all_node_text[j]="port_1" zu;
240 | all_node_text[j]=a;
241 | all_node_size[j]=middle;
242 | all_node_colour[j]=in_col;
243 | j++;
244 | # all_node_text[j]="port_2" zu;
245 | all_node_text[j]=b;
246 | all_node_size[j]=left;
247 | all_node_colour[j]=out_col;
248 | j++;
249 | # all_node_text[j]="port_3" zu;
250 | all_node_text[j]=c;
251 | all_node_size[j]=right;
252 | all_node_colour[j]=out_col;
253 | }
254 | if ( s == "FOE" ) { zu=s node_port_1[i] node_port_2[i] node_port_3[i]; a=node_port_1[i]; b=node_port_2[i]; c=node_port_3[i];
255 | used_port_i[a]++;
256 | used_port_i[b]++;
257 | used_port_i[c]++;
258 | used_port[a]++;
259 | used_port[b]++;
260 | used_port[c]++;
261 | # active ports
262 | # active_port[a]++;
263 | # active_port[b]++;
264 | # active_port[c]++;
265 | #
266 | all_node_text[j]=s;
267 | all_node_size[j]=main_const;
268 | all_node_colour[j]=in_col;
269 | all_edge_target[a]=j+1; all_edge_source[b]=j+2; all_edge_source[c]=j+3;
270 | x1=zu "port_1"; x2=zu "port_2"; x3=zu "port_3";
271 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
272 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
273 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
274 | all_edge_source[x3]=j; all_edge_target[x3]=j+3; all_edge_bond[x3]=bond_int;
275 | used_port[x1]++; used_port[x2]++; used_port[x3]++;
276 | j++;
277 | # all_node_text[j]="port_1" zu;
278 | all_node_text[j]=a;
279 | all_node_size[j]=middle;
280 | all_node_colour[j]=in_col;
281 | j++;
282 | # all_node_text[j]="port_2" zu;
283 | all_node_text[j]=b;
284 | all_node_size[j]=left;
285 | all_node_colour[j]=out_col;
286 | j++;
287 | # all_node_text[j]="port_3" zu;
288 | all_node_text[j]=c;
289 | all_node_size[j]=right;
290 | all_node_colour[j]=out_col;
291 | }
292 | if (s == "Arrow" || s == "NOP2" || s == "PROP" ) { zu=s node_port_1[i] node_port_2[i]; a=node_port_1[i]; b=node_port_2[i];
293 | used_port_i[a]++;
294 | used_port_i[b]++;
295 | used_port[a]++;
296 | used_port[b]++;
297 | all_node_text[j]=s;
298 | if (s == "Arrow" ) { all_node_colour[j]=arrow_col; all_node_size[j]=main_const;} else { if (s == "NOP2" ) { all_node_colour[j]=nop_col; all_node_size[j]=gen_const;} else { all_node_colour[j]=prop_col; all_node_size[j]=gen_const; }}
299 | all_edge_target[a]=j+1; all_edge_source[b]=j+2;
300 | x1=zu "port_1"; x2=zu "port_2";
301 | used_port[x1]++; used_port[x2]++;
302 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
303 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
304 | used_port[x1]++; used_port[x2]++;
305 | j++;
306 | # all_node_text[j]="port_1" zu;
307 | all_node_text[j]=a;
308 | all_node_size[j]=middle;
309 | all_node_colour[j]=in_col;
310 | j++;
311 | # all_node_text[j]="port_2" zu;
312 | all_node_text[j]=b;
313 | all_node_size[j]=middle;
314 | all_node_colour[j]=out_col;
315 | }
316 |
317 | #############################
318 |
319 | if (s == "MULIN" || s == "MULOUT" ) { zu=s node_port_1[i] node_port_2[i]; a=node_port_1[i]; b=node_port_2[i];
320 | used_port_i[a]++;
321 | used_port_i[b]++;
322 | used_port[a]++;
323 | used_port[b]++;
324 | all_node_text[j]=s;
325 | # active ports
326 | # active_port[a]++;
327 | # active_port[b]++;
328 | all_node_size[j]=gen_const;
329 | if (s == "MULIN" ) { all_node_colour[j]=out_col; active_port[b]++; } else { all_node_colour[j]=in_col; active_port[a]++; }
330 | all_edge_target[a]=j+1; all_edge_source[b]=j+2;
331 | x1=zu "port_1"; x2=zu "port_2";
332 | used_port[x1]++; used_port[x2]++;
333 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
334 | all_edge_source[x2]=j; all_edge_target[x2]=j+2; all_edge_bond[x2]=bond_int;
335 | used_port[x1]++; used_port[x2]++;
336 | j++;
337 | # all_node_text[j]="port_1" zu;
338 | all_node_text[j]=a;
339 | all_node_size[j]=middle;
340 | all_node_colour[j]=in_col;
341 | j++;
342 | # all_node_text[j]="port_2" zu;
343 | all_node_text[j]=b;
344 | all_node_size[j]=middle;
345 | all_node_colour[j]=out_col;
346 | }
347 |
348 | ############################
349 |
350 | if (s == "T" ) { zu=s node_port_1[i]; a=node_port_1[i];
351 | used_port_i[a]++;
352 | used_port[a]++;
353 | # active port
354 | # active_port[a]++;
355 | all_node_text[j]=s;
356 | all_node_size[j]=main_const;
357 | all_node_colour[j]=term_col;
358 | all_edge_target[a]=j+1;
359 | x1=zu "port_1";
360 | used_port[x1]++;
361 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
362 | used_port[x1]++;
363 | j++;
364 | # all_node_text[j]="port_1" zu;
365 | all_node_text[j]=a;
366 | all_node_size[j]=middle;
367 | all_node_colour[j]=in_col;
368 | }
369 | if (s == "FROUT" ) { zu=s node_port_1[i]; a=node_port_1[i];
370 | used_port_i[a]++;
371 | used_port[a]++;
372 | all_node_text[j]=s;
373 | all_node_size[j]=main_const;
374 | all_node_colour[j]=out_col;
375 | all_edge_target[a]=j+1;
376 | x1=zu "port_1";
377 | used_port[x1]++;
378 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
379 | used_port[x1]++;
380 | j++;
381 | # all_node_text[j]="port_1" zu;
382 | all_node_text[j]=a;
383 | all_node_size[j]=middle;
384 | all_node_colour[j]=in_col;
385 | }
386 | if (s == "FRIN" ) { zu=s node_port_1[i]; a=node_port_1[i]; used_port_i[a]++;
387 | used_port[a]++;
388 | all_node_text[j]=s;
389 | all_node_size[j]=main_const;
390 | all_node_colour[j]=in_col;
391 | all_edge_source[a]=j+1;
392 | x1=zu "port_1";
393 | used_port[x1]++;
394 | all_edge_source[x1]=j; all_edge_target[x1]=j+1; all_edge_bond[x1]=bond_int;
395 | used_port[x1]++;
396 | j++;
397 | # all_node_text[j]="port_1" zu;
398 | all_node_text[j]=a;
399 | all_node_size[j]=middle;
400 | all_node_colour[j]=out_col;
401 | }
402 |
403 | j++;
404 | }
405 |
406 | j--;
407 | jmax=j;
408 |
409 | for (i in used_port_i ) { all_edge_bond[i]=bond_ext;}
410 |
411 | printf("{ \n \"nodes\": [ \n {\"atom\": \""all_node_text[0]"\", \"size\": " all_node_size[0] ", \"colour\": \"" all_node_colour[0] "\"}") > "graph_before.json";
412 |
413 | for (k=1;k<=jmax; k++) {
414 |
415 | printf(", \n {\"atom\": \""all_node_text[k]"\", \"size\": " all_node_size[k] ", \"colour\": \"" all_node_colour[k] "\"}") >> "graph_before.json";
416 | }
417 |
418 | printf(" \n ], \n \"links\": [ \n") >> "graph_before.json";
419 |
420 | cucu=0;
421 |
422 | for (i in used_port) { a=used_port[i]; fufu=active_port[i]; if ( (a == 2 ) && (fufu < 1) ) { if (cucu == 0 ){
423 |
424 | printf("{\"source\": " all_edge_source[i] ", \"target\": " all_edge_target[i] ", \"bond\": " all_edge_bond[i] "}") >> "graph_before.json"; cucu++; } else{
425 | printf(", \n {\"source\": " all_edge_source[i] ", \"target\": " all_edge_target[i] ", \"bond\": " all_edge_bond[i] "}") >> "graph_before.json"; } }}
426 |
427 | printf(" \n ] \n }") >> "graph_before.json";
428 |
429 | ###################################
430 |
431 |
432 | }
433 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/gen_viral_foe_bubbles.sh:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | printf "choose a file from the list:"
4 |
5 | ls *.mol
6 |
7 | printf "> "
8 |
9 | read firstarg
10 |
11 | filename=${firstarg%%.*}
12 |
13 | awk -f gen_check_1_foe.awk $firstarg
14 |
15 | awk -f foe_bubbles_04_11.awk $firstarg
16 |
17 | cp graph_before.json "$filename"_0.json
18 |
19 | cp graph_before.json file_0.json
20 |
21 |
22 |
23 | for ((a=1; a <= 20 ; a++))
24 | do
25 | awk -f gen_check_1_foe.awk temp_final_nodes
26 |
27 | cp graph_before.json "$filename"_"$a".json
28 |
29 | cp graph_before.json file_"$a".json
30 |
31 | awk -f foe_bubbles_04_11.awk temp_final_nodes
32 | done
33 |
34 | cp temp_final_nodes continue.mol
35 |
36 | printf "10 reduction steps available, look at them with look.html in your browser"
37 |
38 | printf "\n ... if you want the next 10 steps then: \n - write again \"bash main_viral.sh\" \n - choose the file continue.mol from the list \n - reload look.html in your browser \n"
39 |
40 |
--------------------------------------------------------------------------------
/scripts_and_mol_files/lfoafoe.mol:
--------------------------------------------------------------------------------
1 | A b1 a1 c1
2 | FOE c1 b1 d1
3 | FO b2 a1 c2
4 | L c2 a2 b2
--------------------------------------------------------------------------------
/scripts_and_mol_files/look.html:
--------------------------------------------------------------------------------
1 |
2 |
3 |
96 |
97 |
99 |
100 |
101 |