#!/usr/bin/env python import math def fibomod(n): values = [0, 1] while not ( values[-2] == 1 and values[-1] == 0): x = (values[-1] + values[-2]) % n values.append(x) return values[:-1] def fibopoint(cx, cy, r, p, n): theta = 2 * math.pi * p / n return ( cx + r * math.sin(theta), cy - r * math.cos(theta) ) def fibopoly(cx, cy, r, n): return [ fibopoint(cx, cy, r, p, n) for p in fibomod(n) ] def svgpoly(points): ps = " ".join([ f"{x},{y}" for (x, y) in points ]) return f'' def svgline(p1, p2): return f'\n' def svglines(points): lines = "" for i in range(1, len(points)): p2 = points[i] p1 = points[i - 1] lines += svgline(p1, p2) lines += svgline(points[-1], points[0]) return lines print('') n = 2 for j in range(11): for i in range(7): cx = 50 + i * 100 cy = 50 + j * 100 r = 40 print(svglines(fibopoly(cx, cy, r, n))) n += 1 print('')