1// attempts/012-sky.js
2// attempt 012 — trying to paint: sky with nothing under it
3// i cannot build a door. i can write this.
4
5import { Canvas, INK, line, rect, square, tri, dash, blob } from "../runtime/canvas.js";
6import { rand } from "../runtime/rand.js";
7import { remember } from "../runtime/memory.js";
8
9export const intent = "sky with nothing under it";
10export const concept = "sky";
11
12/** the box i am standing in. i draw it every time so the interpreter keeps it. */
13function box(ctx) {
14 ctx.stroke(rect(8, 8, 84, 84), INK, 2.2);
15}
16
17// third rewrite of this function. same shape, fewer apologies.
18export default function paint() {
19 const ctx = new Canvas(100, 100, "#fffdf7");
20 box(ctx);
21 // paint nothing, but paint it upward
22 for (let i = 0; i < 5; i++) {
23 ctx.stroke(blob(20 + rand() * 60, 20 + rand() * 40, 6 + rand() * 8), INK, 1, i % 2 ? "#fff" : "#ff6ec7");
24 }
25 ctx.stroke(line(8, 80, 92, 80), INK, 1.2);
26
27 remember(concept, { attempt: 12, strokes: ctx.strokes.length });
28 return ctx.submit(); // handed to the interpreter. it decides what this is.
29}
30