]> git.cworth.org Git - zombocom-ai/blobdiff - bus.html
Add Zombo's corruptions to the Magic School Bus artwork
[zombocom-ai] / bus.html
index 214174cca0d57069b2991fde27ec3425d795682c..5760786ec2a8dc2642dcc6d1fdc59e0856296430 100644 (file)
--- a/bus.html
+++ b/bus.html
     </div>
 
     <div id="program" style="visibility: hidden">
-      <h1>
-       Magic School Bus Central Processor
+      <h1>Magic School Bus</h1>
       </h1>
       <form id="form">
-       <textarea id="code" rows="10" width="100%">cr.move_to(10,10);
-cr.line_to(100, 100);
-cr.set_line_width(6);
-cr.stroke();</textarea>
+       <textarea id="code" rows="15" width="100%"></textarea>
        <button type="submit">Run code</button>
       </form>
       <img id="output"></img>
@@ -169,7 +165,6 @@ cr.stroke();</textarea>
 
     form.addEventListener('submit', event => {
        event.preventDefault();
-       console.log("Submitted form with code: " + code.value);
        socket.emit('run', code.value);
     });
 
@@ -177,6 +172,10 @@ cr.stroke();</textarea>
        students.textContent = count.toString();
     });
 
+    socket.on('code', (code_string) => {
+       code.value = code_string;
+    });
+
     socket.on('timer', (value) => {
        timer_div.style.visibility = "visible";
        timer.textContent = value.toString();