mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
Three of his six reports from the first day with the mirror on, the ones that needed no review first: - A kitten swam on the wet sand where the tide meets the shore. The swimmer lanes ended a fixed distance above the companion's row, which on a tall scape is below the waterline. They now stop two rows above the shore's own mean waterline, read off the shore every frame. - The done knock carried the agent's whole last message across the sea in a dotted box. Balloon text is capped at 44 runes with an ellipsis; a short ask is untouched. - Diffing the host's model against Terminal.app's readback of a real Claude Code startup found ESC ( B drawn as a 'B': charset designations are ESC plus an intermediate plus one final byte. Modelled, with a split-read test. Also notes/gradientaudit: the per-hour measurement of the 256 sky and sea (distinct tones, band heights, largest CIE76 step) at his 124x62 geometry, for the gradient review he asked to do together before anything changes. No palette changed. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01NtoYrsT7EnxmaDCjF2Bc3p
104 lines
3.3 KiB
Go
104 lines
3.3 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"strings"
|
|
|
|
"github.com/donlucasx/xscapes/internal/canvas"
|
|
"github.com/donlucasx/xscapes/internal/companion"
|
|
"github.com/donlucasx/xscapes/internal/scape"
|
|
"github.com/donlucasx/xscapes/internal/term"
|
|
)
|
|
|
|
// stripPage stacks every frame vertically with no chrome and a line height
|
|
// fixed in pixels, so one screenshot can be sliced into exact frames and
|
|
// assembled into a GIF. Capturing frames one at a time would be dozens of
|
|
// round trips; this is one.
|
|
func stripPage(seed int64, frames int, fps float64, mode string) string {
|
|
const (
|
|
w, h = 72, 24
|
|
fontPx = 14
|
|
)
|
|
cat := companion.NewCat()
|
|
|
|
var b strings.Builder
|
|
fmt.Fprintf(&b, `<!doctype html><html><head><meta charset="utf-8"><style>`+
|
|
`html,body{margin:0;padding:0;background:#000}`+
|
|
`pre{margin:0;padding:0;display:block;font-family:Menlo,monospace;`+
|
|
`font-size:%dpx;line-height:%dpx;letter-spacing:0}`+
|
|
`</style></head><body>`, fontPx, fontPx)
|
|
|
|
for i := 0; i < frames; i++ {
|
|
t := float64(i) / fps
|
|
c := canvas.New(w, h, canvas.AlphaFar, canvas.AlphaMid, canvas.AlphaNear)
|
|
|
|
switch mode {
|
|
case "walk":
|
|
ww, wh := cat.WalkSize()
|
|
x0, x1 := 4, w-ww-4
|
|
half := frames / 2
|
|
px, dir := x0+(x1-x0)*i/half, 1
|
|
if i >= half {
|
|
px, dir = x1-(x1-x0)*(i-half)/half, -1
|
|
}
|
|
scape.NewShore(seed, false).Update(c, t, scape.Activity{Working: true, Level: 0.5})
|
|
cat.DrawWalk(c.Near(), px, c.H-2-wh, float64(px)*0.8*float64(dir), dir)
|
|
default:
|
|
st := companion.Working
|
|
act := scape.Activity{Working: true, Level: 0.65}
|
|
switch mode {
|
|
case "resting":
|
|
st, act = companion.Resting, scape.Activity{}
|
|
case "needsyou":
|
|
st = companion.NeedsYou
|
|
case "done":
|
|
st, act = companion.Done, scape.Activity{Level: 0.3}
|
|
case "kittens":
|
|
st, act = companion.Working, scape.Activity{Working: true, Level: 0.7}
|
|
case "worried":
|
|
st, act = companion.Worried, scape.Activity{Working: true, Level: 0.35}
|
|
case "tour":
|
|
// One loop through every state, so a single GIF carries the
|
|
// whole vocabulary.
|
|
switch (i * 5) / frames {
|
|
case 0:
|
|
st, act = companion.Working, scape.Activity{Working: true, Level: 0.9}
|
|
case 1:
|
|
st, act = companion.Worried, scape.Activity{Working: true, Level: 0.3}
|
|
case 2:
|
|
st = companion.NeedsYou
|
|
case 3:
|
|
st, act = companion.Done, scape.Activity{Level: 0.3}
|
|
default:
|
|
st, act = companion.Resting, scape.Activity{}
|
|
}
|
|
}
|
|
scape.NewShore(seed, false).Update(c, t, act)
|
|
cw, chh := cat.Size()
|
|
top := c.H - 2 - chh
|
|
cat.Draw(c.Near(), 6, top, t, st)
|
|
if mode == "kittens" {
|
|
cat.DrawKittens(c.Near(), c.Mid(), 6, top, 10, c.W-1, int(float64(c.H)*0.42)+1, 0, t, seed)
|
|
}
|
|
if st == companion.Worried {
|
|
rows := companion.Bubble("tests failing")
|
|
(&companion.Sprite{Rows: rows, Body: term.RGB{R: 240, G: 200, B: 150}, Opaque: true}).
|
|
Draw(c.Near(), 6+cw-2, top-len(rows))
|
|
}
|
|
if st == companion.NeedsYou {
|
|
rows := companion.Bubble("allow Bash?")
|
|
(&companion.Sprite{Rows: rows, Body: bubbleAskCol, Opaque: true}).
|
|
Draw(c.Near(), 6+cw-2, top-len(rows))
|
|
}
|
|
if st == companion.Done {
|
|
rows := companion.DoneBubble("tests passed")
|
|
(&companion.Sprite{Rows: rows, Body: bubbleCol, Opaque: true}).
|
|
Draw(c.Near(), 6+cw-2, top-len(rows))
|
|
}
|
|
}
|
|
b.WriteString(c.HTMLFragment(fontPx))
|
|
}
|
|
b.WriteString(`</body></html>`)
|
|
return b.String()
|
|
}
|