import { useState } from "preact/hooks"; import { disturbanceCount } from "../app/animation.ts"; import { offerThing } from "../app/care.ts"; import { DAY, MIN, STAGE_AGE } from "../app/config.ts"; import { copyText, setAge } from "../app/debug.ts"; import { writeDiary } from "../app/diary.ts"; import { age, dayNum, worldState } from "../app/simulation.ts"; import { save } from "../app/storage.ts"; import { brain, emit, store, ui, view } from "../app/store.ts"; import type { Disturbance, Stat } from "../types.ts"; import { header, wakeChance } from "../world.ts"; export function Debug() { const s = store.state, pet = s.pet; const [days, setDays] = useState(() => (age() / DAY).toFixed(2)); const n = disturbanceCount() + 1; return ( <>
{`brain ${brain.id || "none"} · ${pet.stage}, day ${dayNum()} (${(age() / DAY).toFixed(2)} days old) · offer open: ${s.offer ? offerThing(s.offer) : "none"}`}
{`${s.asleep ? "Asleep" : "Awake"} · next disturbance #${n}: `} {(["talk", "touch", "light"] as Disturbance[]) .map((k) => `${k} ${Math.round(wakeChance(s.stats.energy, k, n) * 100)}%`) .join(" · ")}
Write today's page using the log so far, even if it is short. An early page skips bedtime writing; rewrite it later to include new events.
> ) : (No pet yet.
)}The last prompts sent to the brain, newest first; what it wrote is highlighted. Only kept until the page reloads.
{d.prompt}
{d.text}