Skip to main content
2 of 2
added 112 characters in body
Aaroneous Miller
  • 9.7k
  • 1
  • 24
  • 39

Red, 96 92 87 bytes

Forgot to remove some extra whitespace for -4 bytes.

-5 bytes by using shorter type conversions and initializing and using x at the same time.

draw to-pair x: r * 9 to-block append"circle "append mold to-pair x / 2 append" "mold r

No TIO link because draw doesn't seem to be implemented on TIO. However, you can copy this into the Red offline interpreter to output an image.

The first line is for defining a variable to be used for the canvas size. Multiplying by 9 might be a bit overkill, but it ensures enough padding around the circle. I couldn't figure out how to use variables in the block, so the second line builds the draw command bit by bit, essentially building the command draw {x}x{x} [circle {x / 2}x{x / 2} {r}].

Example output for \$r = 10\$:

enter image description here

Aaroneous Miller
  • 9.7k
  • 1
  • 24
  • 39