From: Carl Worth Date: Fri, 23 Dec 2022 15:52:18 +0000 (-0800) Subject: Drop unneeded semicolons from python code X-Git-Url: https://git.cworth.org/git?p=zombocom-ai;a=commitdiff_plain;h=ffa1852b92b28242e1923f2036026e17766ff849 Drop unneeded semicolons from python code Apparently, the javascript has been getting into my head the past few days. Also, make the default drawing only hit the upper-left quadrant. --- diff --git a/bus.html b/bus.html index df6f572..f16a509 100644 --- a/bus.html +++ b/bus.html @@ -122,18 +122,18 @@
+ random_dot()
diff --git a/interpret-cairo-to-svg.py b/interpret-cairo-to-svg.py index de296f5..bc0c6b1 100755 --- a/interpret-cairo-to-svg.py +++ b/interpret-cairo-to-svg.py @@ -24,7 +24,7 @@ if "import" in input: (fd, filename) = tempfile.mkstemp(suffix=".svg", prefix="busart", dir=OUTPUT_DIR); os.close(fd) -os.chmod(filename, 0o644); +os.chmod(filename, 0o644) # Also delete our import for some more safety del tempfile @@ -789,33 +789,33 @@ COLORS = { 'yellow3': (0xcd/0xff, 0xcd/0xff, 0x00/0xff), 'yellow4': (0x8b/0xff, 0x8b/0xff, 0x00/0xff), 'yellowgreen': (0x9a/0xff, 0xcd/0xff, 0x32/0xff) -}; +} with cairo.SVGSurface(filename, 512, 512) as surface: cr = cairo.Context(surface); del cairo def arc(x, y, r, a1, a2): - cr.arc(x, y, r, a1, a2); + cr.arc(x, y, r, a1, a2) def circle(x, y, r): - cr.arc(x, y, r, 0, 2 * math.pi); + cr.arc(x, y, r, 0, 2 * math.pi) def fill(): - cr.fill(); + cr.fill() def set_color(color): if color in COLORS: - (r,g,b) = COLORS[color]; + (r,g,b) = COLORS[color] else: (r,g,b) = (0,0,0) cr.set_source_rgb(r, g, b) - cr.set_line_width(6); - exec(input) - -web_file = filename.removeprefix(OUTPUT_DIR_PREFIX); + cr.set_line_width(6) -print(web_file); + # Run the submitted code + exec(input) +web_file = filename.removeprefix(OUTPUT_DIR_PREFIX) +print(web_file)