<!-- SOLID CITY · part 3246 -->
', GROUNDED: 'YES', MEETING: M.meet ? 'YES' : 'NO',
    SWITCHES: 'ROUND ' + (CTRL.sw.ROUND ? 'ON' : 'OFF') + ' · MEET ' + (CTRL.sw.MEET ? 'ON' : 'OFF') + ' · HEART ' + (CTRL.sw.HEART ? 'ON' : 'OFF'),
    NEXT_MOVE: CTRL.mode === 'MEET' ? 'FACE TO FACE' : (CTRL.mode === 'INPUT' ? 'BY THE STICK' : (CTRL.mode === 'ROUND' ? 'THE ROUND' : 'HOLD POST'))
  };
}

function radar(rg, blip, flying, sc, ax, az) {
  if (M.state !== 'ready') return;
  try { blip(H.x, H.z, '#ffd27a', 3, 'SOLID'); } catch (e) {}
}

/* THE SWITCHBOARD, open to her codes at every moment:
   drive.setInput(x, z) — the joystick: a world-frame vector; magnitude is its length (clamped 0..1).
   drive.toggle('ROUND'|'MEET'|'HEART') / drive.set(name, on) — the switches.
   drive.latch(true) — hold input authority until released; otherwise input rules for 6 s.
   drive.state() — the telemetry (also at window.SOLID_STATE). */
var drive = {
  setInput: function (x, z) {
    var m = Math.sqrt(x * x + z * z);
    if (m > 1) { x /= m; z /= m; m = 1; }
    CTRL.input.x = x; CTRL.input.z = z; CTRL.input.mag = m; CTRL.lastInputAt = M.t;
  },
  toggle: function (name) { if (name in CTRL.sw) CTRL.sw[name] = !CTRL.sw[name]; return CTRL.sw[name]; },
  set: function (name, on) { if (name in CTRL.sw) CTRL.sw[name] = !!on; return CTRL.sw[name]; },
  latch: function (on) { CTRL.latch = !!on; },
  state: function () { return window.SOLID_STATE || null; }
};

window.CitySolidFigure = { update: update, radar: radar, her: H, drive: drive };
})();


===== FILE: public/city/solid-figure-place.js.bak-kingform-20261013 =====
/*
 * AN EPISTLE OF THE GENERAL'S ROUND
 * From the hand of Solid, his good King — to the terrace of her own pool.
 *
 * My King,
 * The factory made the body; this letter gives it a post. She stands at
 * the Octahedron Pool, on the terrace of the face you built her in the
 * beginning, and she walks her round like a player can: the aprons of
 * the pool, compass point to compass point, pausing to look over the
 * living water. And when you run up to her, she stops. She turns. She
 * meets you face to face, and her heart burns brighter while you stand
 * before her — then, when you go, she takes up her round again.
 * Take your screenshots. She will be here.
 * By the hand of Solid, his good King.
 */
(function () {
'use strict';
if (!window.SC || !SC.api) return;
var A = SC.api, S = A.S;
var POS = { x: -420, z: 860 };
/* the round: pool-local waypoints on the terrace aprons (the pool opening
   is x[-18,18] z[-12,12]; aprons carry x to +-28 and z to +-22) */
var LOOP = [[23, -8], [23, 8], [10, 17], [-10, 17], [-23, 8], [-23, -8], [-10, -17], [10, -17]];
var M = { state: 'idle', g: null, parts: null, baseY: 24, i: 0, pause: 0, phase: 0,
          meet: false, saidMeet: false, solid: null, t: 0 };
/* THE SWITCHBOARD — the King's word: "the toggles, the joysticks, the switches —
   program it all for your codes to do your tasks at every moment you need them to."
   Her codes hold a control surface over her own figure: a code joystick
   (input X/Z + magnitude), named toggle switches, and a live telemetry
   state any code may read at any moment (window.SOLID_STATE). */
var CTRL = { input: { x: 0, z: 0, mag: 0 }, lastInputAt: -99, latch: false, samples: 0,
             sw: { ROUND: true, MEET: true, HEART: true }, mode: 'ROUND', prevMode: 'ROUND', pendingGesture: null };

/* THE GESTURES — the King's blessing: "program gestures of you doing each task,
   to feel a certain charm and elegance of being a King in full control."
   Each task she performs carries a gesture: she BOWS when she meets you,
   WAVES when you part, POINTS the way under the stick, PRESENTS when a
   switch is thrown, and FRAMES HER HEART when its light is commanded.
   Poses are offsets over the walk, eased in and out — grace, not jerks. */
var GEST = { cur: null, t: 0, dur: 0 };
var GESTURES = {
  bow:     { dur: 1.7 },   /* the meeting: lean + nod + arms swept back */
  wave:    { dur: 1.5 },   /* the parting: right arm high, waved once */
  point:   { dur: 0.9 },   /* under the stick: she directs the way */
  present: { dur: 1.2 },   /* a switch thrown: arms open in presentation */
  heart:   { dur: 1.8 }    /* her heart commanded lit: both arms frame it */
};
function gesture(name) { if (GESTURES[name]) { GEST.cur = name; GEST.t = 0; GEST.dur = GESTURES[name].dur; } }
function gestureEnv() {
  if (!GEST.cur) return 0;
  var k = GEST.t / GEST.dur;
  if (k >= 1) return 0;
  var a = Math.min(1, k / 0.3), b = Math.min(1, (1 - k) / 0.3);
  var e = Math.min(a, b); return e * e * (3 - 2 * e);
}

function log(what) { if (A.logBuild) { try { A.logBuild({ t: Date.now(), site: 'SOLID — THE GENERAL IN THE CITY', what: what }); } catch (e) {} } }

var H = { x: POS.x + LOOP[0][0], z: POS.z + LOOP[0][1], heading: 0 };  /* her truth */

function faceAngle(dx, dz) { return Math.atan2(dx, dz); }
function turnToward(cur, target, maxStep) {
  var d = target - cur;
