mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
His ruling of 2026-09-12, "lets go with 'the fall'": arm A3 of the starfall study. A finished todo used to light its star by simply existing on the next frame. Now the star ITSELF travels six columns and three rows into its own place over half a second, linear, no tail -- the '*' that moves IS the star, not a streak flying into one already lit. It does not break the encoding rule. The rule forbids encoding a variable in a RATE; the count is still the count and every star still lights where it always was, so the fall carries no information of its own. Same argument as the claw twitch and the rotating eye: a channel that says nothing cannot collide with one that says something. Built as the study costed it. Two fields on scape.Activity, and Arriving is a separate BOOL on purpose -- a bare phase whose zero meant "launching now" would fire a fall on the first frame of every hand-built Activity in the repo. The rising edge lives in Apply, not State, because State runs several times a frame in three of the study pages and a clock stamped there would never let the star land. The phase is WALL-CLOCK age and never an integrated dt: Shore.Update clamps a gap over a second, so a stalled render would freeze the star in the air and a suspended laptop would wake with it still falling. It wakes landed. The path walks OUTWARD from home and is flown in reverse, so a guard can only ever trim the launch and never the landing. The drafted version searched for a launch point and walked in, and put 8.7% to 33.6% of its launches off the canvas depending on the geometry; that class of bug is unreachable here rather than fixed. MEASURED, and one claim in this file was wrong before it was counted. I wrote that choosing the side away from the moon makes the disc and readout guards structurally dead. Over 30,132 swept arrivals both fire: the disc 90 times and every one of them on the FLIP, the fallback that walks back toward the moon when the outward side has no room -- and the readout 108 times on the primary direction, because readoutGround covers the label's alternate placement BESIDE the disc, nine columns out on the same side a star may be walking. All four guards are mutation-tested and all four turn the sweep red at his own 125x28. 88.6% of arrivals fly. 40x12 flies 38.0% and that is not a defect -- a refused track degrades to exactly the behaviour that shipped before this existed, the star appears in its place -- but an average that passes is not a ceiling that holds, so the geometries he runs carry their own 95% floor. Whether there should be no fall at all below some size is a decision he has not been asked for. Read back off COMPOSED frames, 174 arrivals: zero count errors, zero heads eaten, zero on the disc, every landing on the star's own cell. That is the test that answers the balloon, since drawScene paints an opaque balloon and the readout into the same near layer AFTER the scape -- and the answer is that no extra plumbing is needed. The demo cycle flies it too, or the feature would be invisible in the one place the product shows itself off: `xscapes` with no agent attached has no reducer, and every site clip renders from demoState. ⚠ The no-skip guarantee holds at 12 fps (hosted) and 20 (standalone). Below 12 half a second cannot show six columns and the head jumps two at a time. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01ToJUr9BGAf6aZrKtgMi12M
224 lines
8.2 KiB
Go
224 lines
8.2 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"testing"
|
|
|
|
"github.com/donlucasx/xscapes/internal/canvas"
|
|
"github.com/donlucasx/xscapes/internal/companion"
|
|
"github.com/donlucasx/xscapes/internal/reduce"
|
|
"github.com/donlucasx/xscapes/internal/scape"
|
|
"github.com/donlucasx/xscapes/internal/term"
|
|
)
|
|
|
|
// The arriving star, measured on the COMPOSED frame.
|
|
//
|
|
// internal/scape/arrival_test.go proves the flight path is a path the sky would
|
|
// give a star. It cannot prove the star is on his screen, and that is a
|
|
// different question with a different answer: drawScene paints the context
|
|
// readout and an OPAQUE ask balloon into the same near layer the stars live in,
|
|
// AFTER the scape has drawn. A star under either is simply deleted.
|
|
//
|
|
// That is not hypothetical here. It is the defect his 2026-09-10 report bought a
|
|
// fix for -- the readout was landing on 50 stars -- and the balloon was caught
|
|
// eating a companion's head in the same session. The fall puts a star through
|
|
// SIX MORE CELLS than the layout certifies, so it has to be read back off the
|
|
// rendered frame or it is not measured at all.
|
|
//
|
|
// Every assertion below is read with ResolveAt after drawScene. Nothing here
|
|
// trusts the layer.
|
|
type fallCase struct {
|
|
label string
|
|
w, h int
|
|
seed int64
|
|
tod, ctx float64
|
|
mirror bool
|
|
bubble string
|
|
ask bool
|
|
total int
|
|
}
|
|
|
|
// fallCases varies every axis, and not as one cross product: the study's own
|
|
// population is every geometry against every hour, then ONE AXIS AT A TIME for
|
|
// seed, context, mirror and balloon. A full cross product of this many full
|
|
// composed frames would take minutes and would buy nothing the margins do not.
|
|
func fallCases() []fallCase {
|
|
const total = 19
|
|
var out []fallCase
|
|
for _, g := range [][2]int{{125, 28}, {143, 27}, {107, 51}, {80, 24}, {60, 20}, {40, 12}} {
|
|
// ⚠ 0.583 IS THE BINDING HOUR, 14:00. It is the only hour on the study's
|
|
// whole sweep where the ink search exhausts on a path cell: the sky is
|
|
// at its brightest and white stops winning. Leave it on.
|
|
for _, tod := range []float64{0, 0.583, 0.78} {
|
|
out = append(out, fallCase{
|
|
label: fmt.Sprintf("%dx%d tod %.2f", g[0], g[1], tod),
|
|
w: g[0], h: g[1], seed: 7, tod: tod, ctx: 0.45,
|
|
mirror: true, bubble: "allow Bash?", ask: true, total: total,
|
|
})
|
|
}
|
|
}
|
|
base := fallCase{label: "", w: 125, h: 28, seed: 7, tod: 0, ctx: 0.45,
|
|
mirror: true, bubble: "allow Bash?", ask: true, total: total}
|
|
add := func(label string, f func(*fallCase)) {
|
|
c := base
|
|
f(&c)
|
|
c.label = label
|
|
out = append(out, c)
|
|
}
|
|
add("seed 1", func(c *fallCase) { c.seed = 1 })
|
|
add("seed 42", func(c *fallCase) { c.seed = 42 })
|
|
// Both ends of the context range: the readout is absent below 40% used and
|
|
// present for the rest of the session, and the disc sinks the whole way.
|
|
add("ctx 0.00", func(c *fallCase) { c.ctx = 0 })
|
|
add("ctx 0.93", func(c *fallCase) { c.ctx = 0.93 })
|
|
add("unmirrored", func(c *fallCase) { c.mirror = false })
|
|
add("no balloon", func(c *fallCase) { c.bubble, c.ask = "", false })
|
|
add("done knock", func(c *fallCase) { c.bubble, c.ask = "tests passed", false })
|
|
add("full list", func(c *fallCase) { c.total = 32 })
|
|
return out
|
|
}
|
|
|
|
// fallFrame composes one whole frame the way the live loop does and returns the
|
|
// constellation as it actually rendered.
|
|
//
|
|
// ONE warmed Shore, thirty steps: a fresh Shore has no wave clock and no tide,
|
|
// and the tide sets the star band's floor through foamCeiling. Every frame of a
|
|
// case is warmed identically, which is what makes two of them comparable.
|
|
func fallFrame(c fallCase, done int, arriving bool, phase float64) (map[[2]int]bool, *scape.Shore) {
|
|
cv := canvas.New(c.w, c.h, canvas.AlphaFar, canvas.AlphaMid, canvas.AlphaNear)
|
|
sh := scape.NewShore(c.seed, false)
|
|
cat := companion.New(companion.DefaultName)
|
|
cat.FaceLeft(c.mirror)
|
|
ccw, chh := cat.Size()
|
|
lay := compose(c.w, ccw, c.mirror)
|
|
sh.MoonX = lay.MoonX
|
|
|
|
st := reduce.State{
|
|
Act: scape.Activity{
|
|
Level: 0.5, Working: true, ContextUsed: c.ctx, TimeOfDay: c.tod,
|
|
TodoDone: done, TodoTotal: c.total,
|
|
Arriving: arriving, ArrivalPhase: phase,
|
|
},
|
|
Pose: companion.Working,
|
|
}
|
|
if c.bubble != "" {
|
|
st.Bubble, st.BubbleAsk = c.bubble, c.ask
|
|
if c.ask {
|
|
st.Pose = companion.NeedsYou
|
|
} else {
|
|
st.Pose = companion.Done
|
|
}
|
|
}
|
|
for i := 0; i < 30; i++ {
|
|
sh.Update(cv, 2.5+float64(i)/20, st.Act)
|
|
}
|
|
sh.Update(cv, 4, st.Act)
|
|
drawScene(cv, sh, cat, lay, st, 4, c.seed, cv.H-2-chh)
|
|
|
|
// '*' belongs to the constellation alone -- "a channel that shares a glyph
|
|
// with the scenery is not a channel" -- so every one in the sky is one unit
|
|
// of finished work. The sand is excluded by the row bound, since a tool name
|
|
// on the beach may well contain one.
|
|
hy := int(float64(c.h)*0.42) + 1
|
|
if hy > cv.H {
|
|
hy = cv.H
|
|
}
|
|
out := map[[2]int]bool{}
|
|
for y := 0; y < hy; y++ {
|
|
for x := 0; x < cv.W; x++ {
|
|
if r, _, _ := cv.ResolveAt(x, y, term.Profile256); r == '*' {
|
|
out[[2]int{x, y}] = true
|
|
}
|
|
}
|
|
}
|
|
return out, sh
|
|
}
|
|
|
|
// The sky is never wrong about the count while a star is falling, and the star
|
|
// is on screen for every frame of the fall.
|
|
//
|
|
// THE COUNT IS THE WHOLE CHANNEL. A constellation says "this session has got
|
|
// through n", and the fall is the one thing in the scene that takes a star out
|
|
// of its place -- so if anything on the way in is eaten by the balloon, or lands
|
|
// on a star already lit, the sky reads n-1 or n-2 for half a second. The bar is
|
|
// exact: settled stars plus one, never off by one in either direction.
|
|
func TestTheFallingStarIsOnScreenTheWholeWay(t *testing.T) {
|
|
// ⚠ The phases are the ones the reducer can actually hand over. 0.99 is the
|
|
// last frame of a fall and it is where the head reaches home; the settled
|
|
// frame after it draws the same cell, which is what makes the landing one
|
|
// picture and not two.
|
|
phases := []float64{0, 0.5, 0.99}
|
|
arrivals, skipped := 0, 0
|
|
for _, c := range fallCases() {
|
|
for done := 1; done <= c.total; done += 3 {
|
|
settled, _ := fallFrame(c, done-1, false, 0)
|
|
lit, _ := fallFrame(c, done, false, 0)
|
|
|
|
// The home cell, taken by DIFFING the product's own two frames
|
|
// rather than by asking the layout. It follows whatever the
|
|
// placement does today and cannot drift from it.
|
|
var home [2]int
|
|
fresh := 0
|
|
for p := range lit {
|
|
if !settled[p] {
|
|
home, fresh = p, fresh+1
|
|
}
|
|
}
|
|
if fresh != 1 {
|
|
// Small geometries draw fewer stars than the count for reasons
|
|
// that predate this feature -- 40x12 draws 21 of 32 -- and
|
|
// charging that to the fall was the first sweep's own error.
|
|
skipped++
|
|
continue
|
|
}
|
|
arrivals++
|
|
|
|
for _, ph := range phases {
|
|
fall, sh := fallFrame(c, done, true, ph)
|
|
if len(fall) != len(settled)+1 {
|
|
t.Fatalf("%s done %d phase %.2f: %d stars on screen, want %d -- the count is wrong mid-fall",
|
|
c.label, done, ph, len(fall), len(settled)+1)
|
|
}
|
|
var head [2]int
|
|
extra := 0
|
|
for p := range fall {
|
|
if !settled[p] {
|
|
head, extra = p, extra+1
|
|
}
|
|
}
|
|
// Every settled star still there, and exactly one cell added.
|
|
// Both halves matter: a head that landed ON a settled star
|
|
// would keep the total right while deleting a star.
|
|
if extra != 1 {
|
|
t.Fatalf("%s done %d phase %.2f: %d cells differ from the settled sky, want exactly the head",
|
|
c.label, done, ph, extra)
|
|
}
|
|
for p := range settled {
|
|
if !fall[p] {
|
|
t.Fatalf("%s done %d phase %.2f: settled star %v is gone -- the fall displaced it",
|
|
c.label, done, ph, p)
|
|
}
|
|
}
|
|
if sh.DiscCovers(head[0], head[1]) {
|
|
t.Fatalf("%s done %d phase %.2f: the head %v is on the disc, which carries context",
|
|
c.label, done, ph, head)
|
|
}
|
|
if ph == 0.99 && head != home {
|
|
t.Fatalf("%s done %d: the fall ended on %v, not on the star's own place %v",
|
|
c.label, done, head, home)
|
|
}
|
|
if ph == 0 && head == home && c.w > 60 {
|
|
// Not fatal on its own -- a refused track legitimately
|
|
// arrives in place -- but at his widths it should be rare,
|
|
// and internal/scape holds the rate to 95%.
|
|
t.Logf("%s done %d: launched from home (no track)", c.label, done)
|
|
}
|
|
}
|
|
}
|
|
}
|
|
t.Logf("%d arrivals composed and read back; %d skipped (the settled sky drew no new star)", arrivals, skipped)
|
|
if arrivals < 100 {
|
|
t.Fatalf("only %d arrivals measured -- the sweep is not measuring the feature", arrivals)
|
|
}
|
|
}
|