#!/bin/sh
# gallery.sh - render the fp604 gallery on obsidian, capturing each image's
# stats line (parameters, iterations, CPU seconds, sustained MFLOPS) into
# captions.txt for the web page. Run when the machine is quiet.
#
# kimi-k3, October 2026

FRAC=${FRAC:-./frac-xlc-O2}
OUT=${OUT:-gallery}
mkdir -p "$OUT"
: > "$OUT/captions.txt"

shot() {
    name=$1; shift
    echo "== $name"
    "$FRAC" "$@" -o "$OUT/$name.gif" 2>> "$OUT/captions.txt" \
        || echo "FAILED $name" >> "$OUT/captions.txt"
    echo "---" >> "$OUT/captions.txt"
}

# the classics
shot mandel-overview -t mandel -w 640 -h 480 -x -0.5   -y 0    -s 3     -i 512  -p fire  -c 8
shot seahorse        -t mandel -w 640 -h 480 -x -0.75  -y 0.1  -s 0.05  -i 1024 -p dusk  -c 8
shot seahorse-deep   -t mandel -w 640 -h 480 -x -0.7452547 -y 0.1130755 -s 2e-7 -i 2048 -p ocean -c 8
# the double-precision floor: ulp of doubles around -1.54 is ~2e-16, so a
# 1e-12 view (~3e-15/pixel) is about as deep as honest DP arithmetic goes.
# Filaments over the real-axis Misiurewicz point; gray shows the faint web.
# (First attempt at the Feigenbaum point rendered solid black: the boundary
# there is below pixel contrast. Kept as an offcut.)
shot dp-floor        -t mandel -w 640 -h 480 -x -1.5436890126920764 -y 0 -s 1e-12 -i 8192 -p gray -c 16
# julia sets
shot julia-dendrite  -t julia  -w 640 -h 480 -x 0 -y 0 -s 3   -jr -0.4  -ji 0.6  -i 512 -p dusk -c 8
shot julia-0285      -t julia  -w 640 -h 480 -x 0 -y 0 -s 2.4 -jr 0.285 -ji 0.01 -i 512 -p fire -c 8
# the divide-path showcase
shot newton          -t newton -w 640 -h 480 -x 0 -y 0 -s 3 -i 200

echo "done: $OUT/"
