The task is to draw a regular polygon of n sides using only a compass and an unmarked ruler.
Input (n) is one of the following 10 numbers: 3, 4, 5, 6, 8, 10, 12, 15, 16, 17.
Method: Because you only have a ruler and compass you can only draw points, lines and circles.
A line can only be drawn:
- through two existing points.
A circle can only be drawn:
- with one point as its centre and with its perimeter passing through a second point.
A point can only be drawn:
at the intersection of two lines,
at the intersection(s) of a line and a circle,
at the intersection(s) of two circles,
at the outset, when you may draw 2 points to get started.
Through this process (and only through this process) you must draw the n lines of the requested n-gon, along with any working required to get to that stage.
EDIT: The position of intersections must be calculated, but lines and circles may be drawn by any means provided by the language.
Output is an image of an n-sided regular polygon, showing working.
Graphically there are no restrictions on image size, format, line thickness or anything else not mentioned here. However it must be possible to visually distinguish distinct lines, circles and their intersections. Additionally:
- The n lines that make up your n-gon's sides must be a different colour to your 'working' (i.e. any points, circles or other lines) and a different colour again to your background.
- Working can leave the borders of the drawing area, except points, which must all be within the visible bounds of the image.
- A circle can be a full circle or just an arc (as long as it shows required intersections).
A line is infinite (i.e. leaves the drawing area) or cut off at the two points it goes through.EDIT: A line may be drawn at any length. Points can only be created where the drawn line visually intersects.
- A point can be drawn as you wish, including not marking it.
Scoring is twofold, a submission gets 1 point per input it supports, for a maximum of 10 points. In the event of a draw, shortest byte count wins.
Recognition will be given to submissions that can construct n-gons in the fewest steps or are able to construct n-gons outside of the given range, but it won't help your score.