[art] PlanetGarden: Her planet and the gardener on the board; the author's S2 and S6 recorded with their guards

This commit is contained in:
2026-11-17 19:18:38 +01:00
parent 52d8c0bfd1
commit 1ff00b0e3f
21 changed files with 393 additions and 16 deletions
+5
View File
@@ -36,6 +36,8 @@ export interface Asset {
readonly cells?: readonly Cell[];
readonly include: readonly string[];
readonly avoid: readonly string[];
/** Shared avoid lines this picture may break, each named exactly (the gardener is a person: planet-garden.md). */
readonly allow?: readonly string[];
/** Indices into STYLE.md §7, the review points shown on its card. */
readonly checks: readonly number[];
}
@@ -108,6 +110,9 @@ export function checkManifest(m: Manifest, checklistLength: number): string[] {
problems.push(`${a.id}: a ${a.type} sits over other pictures, so its background must be transparent`);
}
if (a.type !== 'spritesheet' && (a.subject ?? '').trim() === '') problems.push(`${a.id}: no subject`);
for (const line of a.allow ?? []) {
if (!m.avoid.includes(line)) problems.push(`${a.id}: allows "${line}", which is not in the shared avoid list`);
}
for (const i of a.checks) {
if (!Number.isInteger(i) || i < 0 || i >= checklistLength) problems.push(`${a.id}: review point ${i} is not in STYLE.md §7`);
}
+50
View File
@@ -332,6 +332,47 @@ function planet(W: number, H: number, id: string): string {
+ `<g transform="translate(${W / 2} ${top - 4}) scale(1.8)">${drawing(things, id)}</g>`;
}
type Pose = 'stand' | 'walk' | 'pour' | 'pull' | 'sweep' | 'carry' | 'reach' | 'sit';
/** The gardener's stand-in in a 120 × 200 box, feet on the bottom edge, facing right (STYLE.md §3b). */
function gardener(pose: Pose, boy = false): string {
const skin = '#cf9a72', hair = '#7a4b2e', cloth = C.leaf, apron = '#efe4d2';
const lean = { stand: 0, walk: 4, pour: 10, pull: 28, sweep: 18, carry: 6, reach: 14, sit: 0 }[pose];
const arm = { stand: 8, walk: -12, pour: -70, pull: -150, sweep: -40, carry: -80, reach: -95, sit: -30 }[pose];
const legs = pose === 'sit'
? `<path d="M52 160 h26 v34 M62 160 h26 v34" stroke="${boy ? cloth : skin}" stroke-width="12" fill="none" stroke-linecap="round"/>`
: `<path d="M52 196 V 150 M70 196 V 150" stroke="${boy ? cloth : skin}" stroke-width="${boy ? 14 : 10}" stroke-linecap="round"/>`;
const body = boy
? `<path d="M44 92 Q 42 130 46 152 H 76 Q 80 130 78 92 Z" fill="${cloth}" ${ink(4)}/>`
: `<path d="M44 92 Q 36 136 34 156 H 88 Q 86 136 78 92 Z" fill="${cloth}" ${ink(4)}/>`;
const held = pose === 'pour' ? `<rect x="84" y="128" width="26" height="20" rx="6" fill="${C.leaf}" ${ink(3)} transform="rotate(30 97 138)"/>`
: pose === 'carry' ? Array.from({ length: 4 }, (_, i) => `<path d="M${80 + i * 8} 150 v -40" stroke="${C.wood}" stroke-width="6" stroke-linecap="round"/>`).join('') : '';
const braids = boy ? '' : `<path d="M44 58 v 30 M78 58 v 30" stroke="${hair}" stroke-width="7" stroke-linecap="round"/>`;
return `${legs}<path d="M44 198 h18 M64 198 h18" ${ink(7)} stroke-linecap="round"/>
<g transform="rotate(${lean} 61 150)">${body}<path d="M50 100 H 72 V 146 Q 61 152 50 146 Z" fill="${apron}" ${ink(3)}/>
<path d="M44 98 l -8 40" stroke="${skin}" stroke-width="9" stroke-linecap="round"/>
<g transform="rotate(${arm} 78 98)"><path d="M78 98 l 4 40" stroke="${skin}" stroke-width="9" stroke-linecap="round"/></g>${held}
${braids}<circle cx="61" cy="66" r="20" fill="${skin}" ${ink(4)}/>
<path d="M41 62 Q 61 36 81 62 Q 61 52 41 62 Z" fill="${hair}"/>
<ellipse cx="61" cy="50" rx="34" ry="7" fill="#e6c98a" ${ink(3)}/><path d="M47 50 Q 61 28 75 50 Z" fill="#e6c98a" ${ink(3)}/>
<circle cx="66" cy="66" r="2.5" fill="${C.ink}"/><circle cx="74" cy="66" r="2.5" fill="${C.ink}"/><path d="M66 76 q 4 3 8 0" fill="none" ${ink(2.5)}/></g>`;
}
const GARDENER_POSES: Record<string, Pose> = {
'gardener-stand': 'stand', 'gardener-walk': 'walk', 'gardener-pour': 'pour', 'gardener-pull': 'pull',
'gardener-sweep': 'sweep', 'gardener-carry': 'carry', 'gardener-reach': 'reach', 'gardener-sit': 'sit'
};
/** Her home planet's stand-in (STYLE.md S2): a round meadow world, the empty bed on top, the wall and the chair. */
function homePlanet(W: number, H: number, light: 'day' | 'golden' | 'night'): string {
const meadow = { day: C.meadow, golden: '#c9b07a', night: '#3c4a6a' }[light];
const cx = W / 2, cy = H * 0.58, r = W * 0.35;
return `<circle cx="${cx}" cy="${cy}" r="${r}" fill="${meadow}" ${ink(8)}/>
<ellipse cx="${cx}" cy="${cy - r + 6}" rx="${r * 0.32}" ry="${r * 0.07}" fill="${C.soil}" ${ink(5)}/>
<path d="M${cx - r * 0.55} ${cy - r * 0.8} Q ${cx} ${cy - r * 1.1} ${cx + r * 0.5} ${cy - r * 0.84}" fill="none" stroke="#a8957f" stroke-width="22" stroke-linecap="round"/>
<g transform="translate(${cx + r * 0.8} ${cy - r * 0.6}) rotate(55)"><rect x="-26" y="-60" width="52" height="40" rx="5" fill="${C.wood}" ${ink(4)}/><rect x="-30" y="-24" width="60" height="10" fill="${C.petal}" ${ink(4)}/></g>`;
}
/** The share frame's stand-in: meadow along the bottom and up the sides, the middle left empty. */
function shareFrame(W: number, H: number): string {
return `<path d="M0 ${H} V ${H * 0.55} Q ${W * 0.06} ${H * 0.7} ${W * 0.1} ${H * 0.75} Q ${W / 2} ${H * 0.7} ${W * 0.9} ${H * 0.75} Q ${W * 0.94} ${H * 0.7} ${W} ${H * 0.55} V ${H}z" fill="#3c4a6a" ${ink(5)}/>`
@@ -360,6 +401,12 @@ function single(a: Asset): string {
const { width: W, height: H } = a;
switch (a.type) {
case 'sheet': {
if (a.character === 'gardener') {
// The girl along the top, the boy along the bottom; the side and back views are flipped stand-ins.
const row = (boy: boolean, y: number): string =>
[0, 1, 2, 3].map((i) => `<g transform="translate(${90 + i * 360} ${y}) scale(${i === 3 ? '-2' : '2'} 2) translate(${i === 3 ? -120 : 0} 0)">${gardener('stand', boy)}</g>`).join('');
return `<rect width="${W}" height="${H}" fill="${C.paper}"/>${row(false, 40)}${row(true, 560)}`;
}
if (a.character === 'fox') {
const views: FoxLook[] = [{ pose: 'sit', eyes: 'half' }, { pose: 'stand', eyes: 'half' }, { pose: 'stand', eyes: 'half', tilt: -8 }, { pose: 'sit', eyes: 'half', behind: true }];
const figures = views.map((l, i) => `<g transform="translate(${30 + i * 375} 60) scale(1.15)">${fox(l)}</g>`).join('');
@@ -388,6 +435,7 @@ function single(a: Asset): string {
return fit(drawing({ ...PROPS, ...V2_PROPS }, a.id), 200, 200, W, H, 0.7);
case 'layer': {
if (a.id.startsWith('planet-')) return planet(W, H, a.id);
if (a.id.startsWith('home-planet-')) return homePlanet(W, H, a.id.endsWith('golden') ? 'golden' : a.id.endsWith('night') ? 'night' : 'day');
if (a.id === 'share-frame') return shareFrame(W, H);
const time = (['morning', 'day', 'sunset', 'night'] as const).find((t) => a.id.endsWith(t)) ?? 'day';
return garden(W, H, time);
@@ -426,6 +474,8 @@ function cellBody(id: string, W: number, H: number): string {
if (look) return fit(rose(look), 200, 520, W, H);
const pose = FOXES[id];
if (pose) return fit(fox(pose), 300, 240, W, H);
const gardenerPose = GARDENER_POSES[id];
if (gardenerPose) return fit(gardener(gardenerPose), 120, 200, W, H);
if (id in TALL || id in V2_TALL) return fit(drawing({ ...TALL, ...V2_TALL }, id), 200, 400, W, H);
return fit(drawing({ ...PROPS, ...MORE_PROPS, ...V2_PROPS }, id), 200, 200, W, H, 0.7);
}
+6 -3
View File
@@ -71,6 +71,9 @@ const MAKE: Record<Exclude<Asset['type'], 'spritesheet'>, string> = {
const list = (items: readonly string[]): string => items.join('; ');
/** The shared avoid lines, less any this picture is allowed to break. */
const shared = (a: Asset, m: Manifest): string[] => m.avoid.filter((line) => !(a.allow ?? []).includes(line));
/** A sheet is cut apart, so its pictures must not touch. Everything else is said positively in the layout. */
const SHEET_AVOID = ['pictures touching or overlapping', 'grid lines, frames or labels'];
@@ -116,7 +119,7 @@ export function promptFor(a: Asset, m: Manifest, style: string): string {
lines.push(
canvasLine(a.width, a.height, a.background, a.type === 'sprite'),
`Include: ${list(a.include)}`,
`Avoid: ${list([...a.avoid, ...m.avoid])}`,
`Avoid: ${list([...a.avoid, ...shared(a, m)])}`,
board(a.id)
);
return lines.join('\n');
@@ -138,7 +141,7 @@ function sheetPrompt(a: Asset, m: Manifest, style: string): string {
'Pictures:',
...cells.map((c, i) => `${i + 1}. ${c.does}`),
`Include: ${list(a.include)}`,
`Avoid: ${list([...a.avoid, ...SHEET_AVOID, ...m.avoid])}`,
`Avoid: ${list([...a.avoid, ...SHEET_AVOID, ...shared(a, m)])}`,
board(a.id)
].join('\n');
}
@@ -155,7 +158,7 @@ export function cellPromptFor(a: Asset, cell: Cell, m: Manifest, style: string):
`Drawn alike: ${a.angle ?? ''}`,
canvasLine(width, height, 'transparent', true),
`Include: ${list(a.include)}`,
`Avoid: ${list([...a.avoid, ...m.avoid])}`,
`Avoid: ${list([...a.avoid, ...shared(a, m)])}`,
board(`${cell.id} (one picture of ${a.id})`)
].join('\n');
}
+1 -1
View File
@@ -19,7 +19,7 @@ describe('the board data', () => {
for (const c of a.cells ?? []) expect(c).toMatchObject({ id: expect.any(String), width: expect.any(Number), height: expect.any(Number), prompt: expect.any(String) });
}
}
expect(data.checklist).toHaveLength(10);
expect(data.checklist).toHaveLength(12);
expect(data.assets.every((a) => Number.isInteger(a.phase))).toBe(true);
});
+5 -3
View File
@@ -18,15 +18,16 @@ describe('art/manifest.json', () => {
expect(checkManifest(readManifest(), POINTS)).toEqual([]);
});
it('asks for the 34 Phase 1 pictures: the rose sheet first, then her stages, care, moments and touch, the care things, chair, garden, letter and icons', () => {
it('asks for the 46 Phase 1 pictures: the rose sheet first, then her stages, care, moments and touch, the care things, chair, garden, letter, icons, the gardener and her planet', () => {
const m = readManifest();
expect(m.assets[0]?.id).toBe('rose-sheet');
const phase1 = m.assets.filter((a) => a.phase === 1);
const pictures = phase1.flatMap((a: Asset) => (a.cells ? a.cells.map((c) => c.id) : [a.id]));
expect(pictures).toHaveLength(34);
expect(pictures).toHaveLength(46);
expect(pictures).toEqual(expect.arrayContaining([
'rose-bud', 'rose-full-bloom', 'rose-waiting', 'rose-tickled', 'rose-gentle', 'petal-folded', 'weeds-growing',
'watering-can-pouring', 'garden-chair', 'garden-sunset', 'garden-night', 'letter-header', 'app-icon', 'app-icon-maskable', 'favicon-mark'
'watering-can-pouring', 'garden-chair', 'garden-sunset', 'garden-night', 'letter-header', 'app-icon', 'app-icon-maskable', 'favicon-mark',
'gardener-sheet', 'gardener-pour', 'gardener-pull', 'home-planet-day', 'home-planet-night'
]));
});
@@ -68,6 +69,7 @@ describe('checkManifest refuses', () => {
['a Phase 1 picture listed after Phase 3', withAsset('lanterns-sheet', (a) => { a.phase = 1; }), /lanterns-sheet: phase 1 comes after phase 3; list the pictures in phase order/],
['a picture with no subject', withAsset('garden-chair', (a) => { delete a.subject; }), /no subject/],
['a picture nobody uses', withAsset('garden-chair', (a) => { a.usedBy = []; }), /usedBy is empty/],
['an allowance for a line the shared list does not have', withAsset('gardener-sheet', (a) => { a.allow = ['a dragon']; }), /allows "a dragon", which is not in the shared avoid list/],
['a name from the book in a prompt', withAsset('garden-chair', (a) => { a.subject = 'a chair for the Little Prince'; }), /"Little Prince" \(little-prince\)/],
['a medical word in a cell', withAsset('rose-care-sheet', (a) => { (a.cells as { does: string }[])[0]!.does = 'thirsty, waiting to be healed'; }), /"healed" \(medical\)/],
['the word the game never says, in the shared avoid list', (() => { const m = clone(readManifest()); (m.avoid as string[]).push('a lonely look'); return m; })(), /avoid list: "lonely"/]
+18 -6
View File
@@ -23,9 +23,9 @@ describe('STYLE.md', () => {
}
});
it('§7 has the ten review points, a point split over two lines read as one', () => {
it('§7 has the twelve review points, a point split over two lines read as one', () => {
const points = reviewPoints(readStyle());
expect(points).toHaveLength(10);
expect(points).toHaveLength(12);
expect(points[8]).toBe("It reads as one young red-orange fox with a cream mask and a ringed tail, shy and gentle, and nothing like the book's sandy, long-eared fox.");
expect(points[3]).toBe('Nothing from the book: no glass dome, screen, tiny planet, desert, child or scarf, and no look of its drawings.');
});
@@ -37,15 +37,16 @@ describe('STYLE.md', () => {
});
describe('the prompts', () => {
it('every one starts with STYLE.md §1 word for word, then says what to make: 35 cards and 66 one-at-a-time prompts', () => {
expect(allPrompts).toHaveLength(35 + 66);
it('every one starts with STYLE.md §1 word for word, then says what to make: 40 cards and 74 one-at-a-time prompts', () => {
expect(allPrompts).toHaveLength(40 + 74);
for (const p of allPrompts) expect(p.startsWith(style + '\n\nMake: ')).toBe(true);
});
it('every one ends with the shared avoid list and its board id', () => {
const shared = readManifest().avoid.join('; ');
const m = readManifest();
for (const a of data.assets) {
expect(a.prompt).toContain(shared);
const allowed = m.assets.find((x) => x.id === a.id)?.allow ?? [];
expect(a.prompt).toContain(m.avoid.filter((l) => !allowed.includes(l)).join('; '));
expect(a.prompt.endsWith(`\nBoard id: ${a.id}`)).toBe(true);
for (const c of a.cells ?? []) expect(c.prompt.endsWith(`\nBoard id: ${c.id} (one picture of ${a.id})`)).toBe(true);
}
@@ -76,6 +77,17 @@ describe('the prompts', () => {
for (const id of ['care-props-sheet', 'favicon-mark', 'letter-header']) expect(by.get(id)?.attach).toEqual([]);
});
it("only the gardener's own pictures may show a person; every other prompt still says no people (STYLE.md S6)", () => {
const people = 'people, hands or human faces';
for (const a of data.assets) {
const prompts = [a.prompt, ...(a.cells ?? []).map((c) => c.prompt)];
const isGardener = a.attach.includes('gardener-sheet') || a.id === 'gardener-sheet';
// The Avoid line only: §1 itself names the exception for every picture.
for (const p of prompts) expect((p.split('\nAvoid: ')[1] ?? '').includes(people), a.id).toBe(!isGardener);
}
expect(data.assets.find((a) => a.id === 'gardener-poses-sheet')?.attach).toEqual(['gardener-sheet']);
});
it('every rose prompt puts her face on the petals, never on a round head', () => {
for (const a of data.assets.filter((x) => x.attach.includes('rose-sheet') || x.id === 'rose-sheet')) {
for (const p of [a.prompt, ...(a.cells ?? []).map((c) => c.prompt)]) {