"""足跡 / Footprints — 260 random walkers, 1,400 steps each."""
import math
import numpy as np
from PIL import Image, ImageDraw
from _common import W, H, C, rgb, paper, cli


def render(seed, walkers=260, steps=1400):
    rng = np.random.default_rng(seed)
    bg, cols = C["kinari"], [C["tokiwa"], C["uguisu"], C["sumi"]]
    img = Image.new("RGB", (W, H), rgb(bg)); d = ImageDraw.Draw(img)
    for _ in range(walkers):
        x, y = rng.random() * W, rng.random() * H; a = rng.random() * math.tau; pts = [(x, y)]
        for _ in range(steps):
            a += rng.normal(0, 0.18); x += math.cos(a) * 5; y += math.sin(a) * 5; pts.append((x, y))
        d.line(pts, fill=rgb(cols[rng.integers(len(cols))]), width=2)
    return paper(img, rng)


SEED = 101

if __name__ == "__main__":
    cli(render, SEED)
