mirror of
https://github.com/donlucasx/xscapes.git
synced 2026-10-20 08:43:32 +02:00
Two days of his design round: I drew, he ruled from rendered options.
THE CAT. It asks with its ears ("Pricked ears"), finishes with its chin up,
and walks up its own ladder -- 12x7 -> 16x9 -> 24x14, the middle rung the
Faithful Scale-Up with its nose removed, the top rung "Ruffed sit", drawn.
Before this the ask and the finish were the WORKING body: measured over 1,200
frames a pose, bodies only, 97% of a still of either was also a still of the
cat simply working. Now 0%, asserted, with Worried as the positive control.
The crab finishes "settled on the sand" with one pincer shutting every 7 s.
crabDone was DEAD ART -- it raised a claw by a single source row and the row
OR ate it, so all six half-rows were crabWork's. The finish cue has been the
eye glyph alone since it was written.
Its near eye rotates through four faces, picked on the RISING EDGE of an ask
and held. Random carries no information, which is the only reason a second
mark on that channel is legal at all.
THE OR-TRAP, which he caught from both sides. CatBody row 11 is a muzzle gap
row 10 covers, so the cat has never had a mouth on screen. A 16x9 draft grew a
nose; doubling for the top rung grew a mouth. Two general fixes were measured
and rejected -- half-row doubling flattens nine tapered rows, and filling every
covered interior gap also eats the notch between the ears.
FIXED: the cat's mid-stride drew a 16-cell side view inside the 12-cell box and
put the eyes 6 and 10 cells off the head, 4,037 times across 31 sessions ·
hyFloor ignored the horizon and allowed water above it in 81 configurations ·
the unmirrored layout paced the companion toward the frame edge · emit accepted
any word as a kind and confirmed delivery of nothing · XSCAPES_COMPANION was
double-prefixed and had never worked · the cat's parent body had no cleared rim ·
the tail could not scale, so a doubled cat arrived bald · DrawnHeadCol ignored
the mirror, which the crab's symmetric eye cells had hidden.
NOT FIXED, and both put back after measuring worse than the bug: a fractional
tide depth churns 53.62% every frame against ~64% on crossings alone; making
the star separation strict took touching pairs from 10 to 12. Carded with the
numbers. An average that passes is not a ceiling that holds.
Studies, none of them shipping behaviour: -starfall (the star arriving, 1,805
swept arrivals), -catalts (the design round), -decisions (what is still open).
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01P7YSpTVSL4ws8rgG1X4mtt
145 lines
4.6 KiB
Go
145 lines
4.6 KiB
Go
package main
|
|
|
|
import (
|
|
"fmt"
|
|
"os"
|
|
"path/filepath"
|
|
"strings"
|
|
|
|
"github.com/donlucasx/xscapes/internal/companion"
|
|
"github.com/donlucasx/xscapes/internal/envx"
|
|
"github.com/donlucasx/xscapes/internal/event"
|
|
)
|
|
|
|
// The companion is GLOBAL, not per-repo -- the brief locks that: the landscape
|
|
// is keyed to the repo, the animal is yours everywhere. So it lives as one line
|
|
// in ~/.config/xscapes/companion, beside everything else that has to be
|
|
// derivable from $HOME alone by two processes that share no other context.
|
|
|
|
func companionPath() (string, error) {
|
|
h, err := event.Home()
|
|
if err != nil {
|
|
return "", err
|
|
}
|
|
return filepath.Join(h, "companion"), nil
|
|
}
|
|
|
|
// companionEnv is the environment override, and it recognises TWO spellings on
|
|
// purpose.
|
|
//
|
|
// ⚠ THE DOCUMENTED NAME NEVER WORKED. envx.Lookup PREFIXES what it is given,
|
|
// so `envx.Lookup("XSCAPES_COMPANION")` read XSCAPES_XSCAPES_COMPANION -- the
|
|
// variable README.md has advertised since the rename did nothing at all, and
|
|
// the only spelling that ever had an effect was the doubled one nobody would
|
|
// type. Fixed 2026-09-11 at his ruling, "fix it, recognise both names".
|
|
//
|
|
// The doubled spelling is kept for one release rather than deleted because
|
|
// something on a machine may have been set to whatever actually worked, and a
|
|
// key that is renamed out from under installed state orphans it silently --
|
|
// the same lesson a hook marker and a config directory both taught here. The
|
|
// correct name wins when both are set.
|
|
func companionEnv() string {
|
|
if v := strings.TrimSpace(envx.Lookup("COMPANION")); v != "" {
|
|
return v
|
|
}
|
|
return strings.TrimSpace(envx.Lookup("XSCAPES_COMPANION"))
|
|
}
|
|
|
|
// companionPref is which companion to draw: the environment first, so a run can
|
|
// be overridden without changing anything on disk, then the file, then the
|
|
// default.
|
|
//
|
|
// The name is NORMALISED and VALIDATED here, at the point of READING, not only
|
|
// where it is written. A file holding "Crab" or "octopus" used to leave the
|
|
// live loop rebuilding the companion twice a second forever, because the
|
|
// refresh compared the raw string against the animal's own name and never
|
|
// agreed with itself.
|
|
func companionPref() string {
|
|
if v := companionEnv(); v != "" {
|
|
return companionName(v)
|
|
}
|
|
p, err := companionPath()
|
|
if err != nil {
|
|
return companion.DefaultName
|
|
}
|
|
b, err := os.ReadFile(p)
|
|
if err != nil {
|
|
return companion.DefaultName
|
|
}
|
|
if v := strings.TrimSpace(string(b)); v != "" {
|
|
return companionName(v)
|
|
}
|
|
return companion.DefaultName
|
|
}
|
|
|
|
// companionName lower-cases and validates, falling back to the default rather
|
|
// than handing the renderer a name it will have to fall back from on every
|
|
// frame.
|
|
func companionName(v string) string {
|
|
v = strings.ToLower(strings.TrimSpace(v))
|
|
for _, n := range companion.Names() {
|
|
if n == v {
|
|
return v
|
|
}
|
|
}
|
|
return companion.DefaultName
|
|
}
|
|
|
|
func setCompanionPref(name string) error {
|
|
p, err := companionPath()
|
|
if err != nil {
|
|
return err
|
|
}
|
|
if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil {
|
|
return err
|
|
}
|
|
return os.WriteFile(p, []byte(name+"\n"), 0o644)
|
|
}
|
|
|
|
// cmdCompanion is `xscapes companion [name]`: no argument reports, an argument
|
|
// sets. Validated before it writes, so the file can never hold a name the
|
|
// renderer would have to fall back from.
|
|
func cmdCompanion(args []string) int {
|
|
if len(args) == 0 {
|
|
cur := companionPref()
|
|
fmt.Printf("companion: %s\n", cur)
|
|
if src := companionEnv(); src != "" {
|
|
name := "XSCAPES_COMPANION"
|
|
if strings.TrimSpace(envx.Lookup("COMPANION")) == "" {
|
|
name = "XSCAPES_XSCAPES_COMPANION (the old spelling; use XSCAPES_COMPANION)"
|
|
}
|
|
fmt.Printf(" (from %s = %q; the saved setting is not in use)\n", name, src)
|
|
if companionName(src) != strings.ToLower(strings.TrimSpace(src)) {
|
|
fmt.Printf(" ⚠ %q is not a companion, so the default is drawn instead\n", src)
|
|
}
|
|
}
|
|
fmt.Printf("available: %s\n", strings.Join(companion.Names(), ", "))
|
|
return 0
|
|
}
|
|
name := strings.ToLower(strings.TrimSpace(args[0]))
|
|
if name == "-h" || name == "--help" || name == "help" {
|
|
fmt.Printf("usage: xscapes companion [%s]\n", strings.Join(companion.Names(), "|"))
|
|
fmt.Printf(" no argument prints the current companion.\n")
|
|
return 0
|
|
}
|
|
ok := false
|
|
for _, n := range companion.Names() {
|
|
if n == name {
|
|
ok = true
|
|
}
|
|
}
|
|
if !ok {
|
|
fmt.Fprintf(os.Stderr, "xscapes: no companion called %q. available: %s\n",
|
|
name, strings.Join(companion.Names(), ", "))
|
|
return 2
|
|
}
|
|
if err := setCompanionPref(name); err != nil {
|
|
fmt.Fprintf(os.Stderr, "xscapes: %v\n", err)
|
|
return 1
|
|
}
|
|
p, _ := companionPath()
|
|
fmt.Printf("companion: %s\n", name)
|
|
fmt.Printf("saved to %s -- a running scape picks it up on its next frame.\n", p)
|
|
return 0
|
|
}
|