git @ Cat's Eye Technologies noit-o-mnain-worb / d628eb6
Use make-files-jsonp to contain the example programs in JSONP. Chris Pressey 4 years ago
2 changed file(s) with 56 addition(s) and 145 deletion(s). Raw diff Collapse all Expand all
0 examplePrograms = [
1 [
2 "division.worb",
3 "############\n#..........#\n#######v####\n # #\n #v####\n # #\n #v####\n # #\n #v####\n # #\n ######\n"
4 ],
5 [
6 "fast-loop.worb",
7 "#######\n# < < #\n# ### #\n# >.> #\n#######\n"
8 ],
9 [
10 "freefill.worb",
11 "######################\n# #\n# #\n# #\n# #\n# #\n# + #\n# #\n# #\n# #\n# #\n######################\n"
12 ],
13 [
14 "heater.worb",
15 " #########\n #! ! ! !#\n###### ! ! ! ######\n#+ ! ! ! ! -#\n###### ! ! ! ######\n #! ! ! !#\n #########\n"
16 ],
17 [
18 "magnetic-field.worb",
19 "######################\n# #\n# #\n# #\n# --- #\n# --- #\n# +++ #\n# +++ #\n# #\n# #\n# #\n######################"
20 ],
21 [
22 "or-gate.worb",
23 "##### #####\n# ########### #\n# . > < . #\n# #####v##### #\n##### # ########\n # >!#\n #v#########\n # #\n ###\n"
24 ],
25 [
26 "pressure.worb",
27 "#######################\n#..........> #\n#######################\n"
28 ],
29 [
30 "slow-loop.worb",
31 "#####################\n# < #\n# ################# #\n# # # #\n# # #.#\n# # # #\n# ################# #\n# > #\n#####################\n"
32 ],
33 [
34 "subtraction.worb",
35 "###############\n#.............#\n#######v#######\n # #\n #########\n\n"
36 ],
37 [
38 "theory-of-time.worb",
39 "######################\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n#.......... #\n######################\n"
40 ],
41 [
42 "transistor.worb",
43 " ###\n### #+#\n#+# # #\n# #######v#\n# < #\n### < #\n # < #\n #######v#\n # #\n #!#\n #-#\n ###"
44 ]
45 ];
88 display: inline-block;
99 }
1010 #load_indicator { border: 1px solid purple; }
11 .example_configuration { display: none; }
1211 </style>
1312 </head>
1413 <body>
3231
3332 <textarea id="editor" rows="25" cols="40"></textarea>
3433
35 <div id="division" class="example_configuration"
36 >############
37 #..........#
38 #######v####
39 # #
40 #v####
41 # #
42 #v####
43 # #
44 #v####
45 # #
46 ######
47 </div>
48
49
50 <div id="fast-loop" class="example_configuration"
51 >#######
52 # &lt; &lt; #
53 # ### #
54 # &gt;.&gt; #
55 #######
56 </div>
57
58
59 <div id="freefill" class="example_configuration"
60 >######################
61 # #
62 # #
63 # #
64 # #
65 # #
66 # + #
67 # #
68 # #
69 # #
70 # #
71 ######################
72 </div>
73
74
75 <div id="heater" class="example_configuration"
76 > #########
77 #! ! ! !#
78 ###### ! ! ! ######
79 #+ ! ! ! ! -#
80 ###### ! ! ! ######
81 #! ! ! !#
82 #########
83 </div>
84
85
86 <div id="magnetic-field" class="example_configuration"
87 >######################
88 # #
89 # #
90 # #
91 # --- #
92 # --- #
93 # +++ #
94 # +++ #
95 # #
96 # #
97 # #
98 ######################</div>
99
100
101 <div id="or-gate" class="example_configuration"
102 >##### #####
103 # ########### #
104 # . &gt; &lt; . #
105 # #####v##### #
106 ##### # ########
107 # &gt;!#
108 #v#########
109 # #
110 ###
111 </div>
112
113
114 <div id="pressure" class="example_configuration"
115 >#######################
116 #..........&gt; #
117 #######################
118 </div>
119
120
121 <div id="slow-loop" class="example_configuration"
122 >#####################
123 # &lt; #
124 # ################# #
125 # # # #
126 # # #.#
127 # # # #
128 # ################# #
129 # &gt; #
130 #####################
131 </div>
132
133
134 <div id="subtraction" class="example_configuration"
135 >###############
136 #.............#
137 #######v#######
138 # #
139 #########
140
141 </div>
142
143
144 <div id="theory-of-time" class="example_configuration"
145 >######################
146 #.......... #
147 #.......... #
148 #.......... #
149 #.......... #
150 #.......... #
151 #.......... #
152 #.......... #
153 #.......... #
154 #.......... #
155 #.......... #
156 ######################
157 </div>
158
159
160 <div id="transistor" class="example_configuration"
161 > ###
162 ### #+#
163 #+# # #
164 # #######v#
165 # &lt; #
166 ### &lt; #
167 # &lt; #
168 #######v#
169 # #
170 #!#
171 #-#
172 ###</div>
173
174
17534 </body>
17635 <script src="../src/yoob/controller.js"></script>
17736 <script src="../src/yoob/playfield.js"></script>
17938 <script src="../src/yoob/preset-manager.js"></script>
18039 <script src="../src/yoob/source-manager.js"></script>
18140 <script src="../src/worb.js"></script>
41 <script src="../../../eg/index.js"></script>
18242 <script>
18343 var loadIndicator = document.getElementById('load_indicator');
18444 var controlPanel = document.getElementById('control_panel');
21878
21979 var presetManager = (new yoob.PresetManager()).init({
22080 selectElem: document.getElementById('select_source'),
221 setPreset: function(id) {
222 sourceManager.loadSourceFromHTML(document.getElementById(id).innerHTML);
81 });
82 function makeCallback(sourceText) {
83 return function(id) {
84 sourceManager.loadSource(sourceText);
22385 }
224 }).populateFromClass('example_configuration').select('theory-of-time');
225
86 }
87 for (var i = 0; i < examplePrograms.length; i++) {
88 presetManager.add(examplePrograms[i][0], makeCallback(examplePrograms[i][1]));
89 }
90 presetManager.select(examplePrograms[0][0]);
22691 </script>