]> git.cworth.org Git - zombocom-ai/blobdiff - bus.html
Assign different default code to each boy
[zombocom-ai] / bus.html
index f16a509ae18bfea5b72955cf5a0f9d30be55c1d6..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%">def random_dot():
-  x = 200 * random()
-  y = 200 * random()
-  radius = 4 + 6 * random()
-  circle(x, y, radius)
-  fill()
-
-for i in range(100):
-  if i %2 == 0:
-    set_color('red')
-  else:
-    set_color('blue')
-  random_dot()</textarea>
+       <textarea id="code" rows="15" width="100%"></textarea>
        <button type="submit">Run code</button>
       </form>
       <img id="output"></img>
@@ -185,6 +172,10 @@ for i in range(100):
        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();