mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
His two reports of 2026-09-06, from long live sessions. The sun. lit = 1 - ContextUsed and the terminator is a second disc sliding across at 2*rr*lit, so a slate mass grew on the SUN as the context filled and cleared at a compaction -- "the Sun seems to break sometimes, and fix itself". Measured in his 134x71 frame at 49%: the lit body ends at x677 and the slate runs on to x719, 2.6 cells past it. His ruling: the sun wanes as a crescent. The unlit face is no longer painted by day; at night the moon keeps its shaded face, which is what stopped a moon one column into its phase reading as bitten. SunShadow = "slate" keeps the old look for the study. The thin lines are NOT fixed here, they are measured. U+2584's ink runs from 17 to 29.4 of a 30px row, not to 30 -- the "bottom-exact" reading of 2026-09-05 was half a logical pixel out. The last device pixel row of every split cell falls back to the cell's background, the row below carries the lower colour by construction, and it reads as a rule across a flat band: 5 in his sky, 4 more inside the disc. It is every two-colour cell, not the sun and not the ramp specifically, and U+2580 is worse (its ink starts 5px down). notes/lineprobe draws a frame with Terminal.app's measured geometry so the hairline is visible in a browser; a page that paints a split cell as two flat halves cannot show it. He is testing his terminal's line spacing before ruling on what to trade. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
85 lines
3.3 KiB
Go
85 lines
3.3 KiB
Go
package scape
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/donlucasx/xscapes/internal/canvas"
|
|
"github.com/donlucasx/xscapes/internal/term"
|
|
)
|
|
|
|
// By DAY the disc is the sun, and a sun has no unlit face. His report of
|
|
// 2026-09-06, from long live sessions: "the Sun seems to break sometimes, and
|
|
// fix itself - mostly has to do when the context depletes, the shadow
|
|
// underneath". It was the terminator: lit = 1 - ContextUsed, so the shadow
|
|
// disc slides across as the context fills and snaps clear at a compaction,
|
|
// and by day that unlit face is a slate mass hanging off the sun -- measured
|
|
// in his 134x71 frame at 49%, the lit body ends at x677 and the slate runs on
|
|
// to x719. His ruling: the sun WANES AS A CRESCENT.
|
|
//
|
|
// At night the moon keeps its shaded face; that is what makes the disc read
|
|
// as a whole body rather than a bitten one, and it is not what he reported.
|
|
func TestTheSunWanesAsACrescentButTheMoonKeepsItsShadedFace(t *testing.T) {
|
|
const w, h = 130, 22
|
|
const used = 0.6 // enough shadow that the far limb is well inside it
|
|
|
|
render := func(tod float64, edge string) (*canvas.Canvas, *Shore) {
|
|
c := canvas.New(w, h, canvas.AlphaFar, canvas.AlphaMid, canvas.AlphaNear)
|
|
sh := NewShore(7, false)
|
|
sh.MoonX = 0.28
|
|
sh.MoonEdge = edge
|
|
sh.Update(c, 2, Activity{ContextUsed: used, TimeOfDay: tod})
|
|
return c, sh
|
|
}
|
|
// The far limb: the disc's rightmost column at a full disc, which the
|
|
// terminator has swallowed by 60%.
|
|
farLimb := func(tod float64) (x, y int) {
|
|
c, sh := render(tod, "")
|
|
control, _ := render(tod, "none")
|
|
mx, my := sh.MoonPos()
|
|
rx, _ := sh.MoonExtent()
|
|
for dx := rx + 1; dx > 0; dx-- {
|
|
if mx+dx >= w {
|
|
continue
|
|
}
|
|
ch, fg, bg := c.ResolveAt(mx+dx, my, term.Profile256)
|
|
ch0, fg0, bg0 := control.ResolveAt(mx+dx, my, term.Profile256)
|
|
if ch != ch0 || fg != fg0 || bg != bg0 {
|
|
return mx + dx, my
|
|
}
|
|
}
|
|
t.Fatalf("tod %.2f: no disc found on the moon's row", tod)
|
|
return 0, 0
|
|
}
|
|
painted := func(tod string, todv float64, x, y int) bool {
|
|
c, _ := render(todv, "")
|
|
control, _ := render(todv, "none")
|
|
ch, fg, bg := c.ResolveAt(x, y, term.Profile256)
|
|
ch0, fg0, bg0 := control.ResolveAt(x, y, term.Profile256)
|
|
t.Logf("%s cell (%d,%d): disc %q %v/%v sky %q %v/%v", tod, x, y, string(ch), fg, bg, string(ch0), fg0, bg0)
|
|
return ch != ch0 || fg != fg0 || bg != bg0
|
|
}
|
|
|
|
// Midday. The far limb sits inside the terminator, so nothing should be
|
|
// painted there: the sun is a crescent open to the shadow, not a disc
|
|
// with a slate half.
|
|
const midday = 0.5
|
|
x, y := farLimb(0.05) // the extent, taken at a phase that shows it
|
|
if _, sh := render(midday, ""); sh.night() {
|
|
t.Fatal("tod 0.5 is not day; the test is pointing at the wrong hour")
|
|
}
|
|
if painted("midday", midday, x, y) {
|
|
t.Errorf("midday: the sun's far limb at (%d,%d) is painted at %.0f%% context; "+
|
|
"the unlit face is still being drawn on the sun", x, y, used*100)
|
|
}
|
|
|
|
// Midnight. The moon keeps its shaded face, so the same cell IS painted.
|
|
const midnight = 0.0
|
|
if _, sh := render(midnight, ""); !sh.night() {
|
|
t.Fatal("tod 0.0 is not night; the test is pointing at the wrong hour")
|
|
}
|
|
if !painted("midnight", midnight, x, y) {
|
|
t.Errorf("midnight: the moon's far limb at (%d,%d) is NOT painted at %.0f%% context; "+
|
|
"the shaded face has gone from the moon as well", x, y, used*100)
|
|
}
|
|
}
|