]> git.cworth.org Git - zombocom-ai/blobdiff - index.js
Make any code execution errors visible to the users
[zombocom-ai] / index.js
index 606fba79adbd99c68135ced4f9efa854c601980e..bfa6d8a1b76342d9a33e8a5469b2ce8523fd1435 100644 (file)
--- a/index.js
+++ b/index.js
@@ -191,7 +191,10 @@ bus_code = [
 for i in range(400):
   set_color('midnight blue' if i % 2 == 0 else 'navy blue')
   set_opacity(0.5)
-  random_dot()`,
+  random_dot()
+
+# The only limit is your fingers!
+fingers()`,
 
     `def random_line():
   x = random_within(512) - 60
@@ -204,7 +207,10 @@ for i in range(400):
 
 for i in range(200):
   set_color('black')
-  random_line()`,
+  random_line()
+
+# This is Zombo.com. Welcome!
+mouths()`,
 
     `def random_blob():
   move_to(random_within(512), random_within(512))
@@ -214,7 +220,10 @@ for i in range(200):
 
 for i in range(100):
   set_random_color()
-  random_blob()`,
+  random_blob()
+
+# The infinite eyes is possible!
+eyes()`,
 
     `def random_curve():
   move_to(random_within(512), random_within(512))
@@ -223,7 +232,11 @@ for i in range(100):
 
 for i in range(200):
   set_color('pink' if i % 2 == 0 else 'lime green')
-  random_curve()`
+  random_curve()
+
+# You can do anything!
+fingers()
+`
 ];
 
 io_bus.on("connection", (socket) => {
@@ -287,7 +300,8 @@ io_bus.on("connection", (socket) => {
            // Give all clients the new image
            io_bus.emit('output', filename);
        } catch (e) {
-           console.log("Error executing turtle script: " + e);
+           // Send any error out to the users
+           io_bus.emit('error', e.toString())
        }
     });