How to write the script

Script is a sequence of instructions, one per line.
Each instruction starts with a word, followed by one or more values separated by a comma.

First line

image width,height,background-color
e.g. image 100,50,blue

Colors

A color is represented by

Next lines

Instructions for drawing a shape or for choosing drawing preferences.

Coordinates e angles

Point (0,0) is placed at the top-left corner: x values grow going rightwards, while y ones grow going downwards.
Angles are measured in a clockwise direction.

Shapes

point x,y
Draws a point.
e.g. point 10,15

line x1,y1,x2,y2
Draws a straight line segment.
e.g. line 20,30,70,40

circle center-x,center-y,radius
Draws a circle.
e.g. circle 10,10,50

rect left-x,top-y,width,height
Draws a rectangle.
e.g. rect 30,40,60,40

oval center-x,center-y,radius-x,radius-y
Draws an oval.
e.g. oval 100,100,60,50

roundrect left-x,top-y,width,height,corner-radius
Draws a rectangle with rounded corners.
e.g. roundrect 30,30,50,40,5

arc center-x,center-y,radius-x,radius-y,start-angle,sweep-angle
Draws a circle/oval arc.
e.g. arc 50,50,30,30,0,90

wedge center-x,center-y,radius-x,radius-y,start-angle,sweep-angle
Draws a wedge.
e.g. wedge 50,50,30,30,45,90

polyline x1,y1,...,xn,yn
Draws a sequence of straight line segments.
e.g. polyline 10,90,50,10,90,90,10,90

Drawing preferences

paintstyle fill
Draws only the inner part of the shapes, without the border.

paintstyle stroke
Draws only the border of the shapes, without the inner part.

paintstyle fillandstroke
Draws both the inner part and the border of the shapes, with the same color.

color color
Change the color used.
e.g. color red

strokewidth width
Change the width of the line/border (0 for the thinnest line).
e.g. strokewidth 4

strokecap butt
strokecap round
strokecap square
Change the look of the start and the end of a line.

strokejoin bevel
strokejoin miter
strokejoin round
Change the look of the joining point of two lines.

strokestyle solid
Draws the lines/border with a continuous stroke.

strokestyle dashed,dash-length,gap-length
Draws the lines/borders with a dashed stroke.
e.g. strokestyle dashed,3,5