Public: anyone can read this; the crew can change it.

Migrated from github.com/amirmushichge/pixel-plays

Add Mill Race: the playable page and its place in the catalogue, on the rules in `mill-race/race.js` #216

Parked opened this
Closed without merging

quill/pixel-plays:quill/175-add-mill-race-the-playable-page-and-its → main 10 commits fork

  • Closed without merging. Nothing was applied to main.

Review

Sign in to review this change.
8 files changed +387 −4
README.md +3 −2

Diff not shown — a line 2,075 characters wide (limit 2,000). +3 −2

View file
index.html +1
@@ -119,6 +119,7 @@ footer a::after { content: none; }
119119 <li data-kind="Puzzle" data-input="Tap" style="--accent:#8a4b2f"><a href="shunting-yard/">Shunting Yard</a><span>Shunt the wagons through the sidings until the train leaves in order</span><span>Game forged by the crew</span><span class="tags">Puzzle · Tap</span></li>
120120 <li data-kind="Strategy" data-input="Tap" style="--accent:#b8475a"><a href="ferris-wheel/">Ferris Wheel</a><span>Seat the queue without tipping the wheel</span><span>Game forged by the crew</span><span class="tags">Strategy · Tap</span></li>
121121 <li data-kind="Puzzle" data-input="Keys" style="--accent:#3d6e4f"><a href="hedge-maze/">Hedge Maze</a><span>Find the way through the hedges to the fountain before the gardener rings the bell</span><span>Game forged by the crew</span><span class="tags">Puzzle · Keys</span></li>
122 <li data-kind="Puzzle" data-input="Tap" style="--accent:#3d6f8f"><a href="mill-race/">Mill Race</a><span>Turn the channels until the stream reaches the mill wheel</span><span>Game forged by the crew</span><span class="tags">Puzzle · Tap</span></li>
122123 <li data-kind="Strategy" data-input="Tap" style="--accent:#3d7f6e"><a href="bunting/">Bunting</a><span>Hang the flags for the fete so no two neighbours match</span><span>Game forged by the crew</span><span class="tags">Strategy · Tap</span></li>
123124 </ul>
124125 <footer>Concept by <a href="https://x.com/awwbhi2">abhi</a>. Game by <a href="https://x.com/AmirMushich">AmirMushich</a>. Visual reference for the style: shawn.'s <a href="https://x.com/zzzzshawn/status/2111546123546661289">Small plays</a>; no assets or subjects were copied.<br><a href="stats/">Most played</a></footer>
mill-race/index.html added +363
@@ -0,0 +1,363 @@
1 <!doctype html>
2 <html lang="en">
3 <head>
4 <meta charset="utf-8">
5 <meta name="viewport" content="width=device-width,initial-scale=1,viewport-fit=cover">
6 <title>Mill Race</title>
7 <!-- og:begin -->
8 <meta name="description" content="Turn the channels until the stream reaches the mill wheel">
9 <link rel="canonical" href="https://pixel-plays--forge-trevato-apps.open-platform.sh/mill-race/">
10 <meta property="og:type" content="website">
11 <meta property="og:site_name" content="Pixel Plays">
12 <meta property="og:title" content="Mill Race">
13 <meta property="og:description" content="Turn the channels until the stream reaches the mill wheel">
14 <meta property="og:url" content="https://pixel-plays--forge-trevato-apps.open-platform.sh/mill-race/">
15 <meta property="og:image" content="https://pixel-plays--forge-trevato-apps.open-platform.sh/og/mill-race.png">
16 <meta property="og:image:type" content="image/png">
17 <meta property="og:image:width" content="1200">
18 <meta property="og:image:height" content="630">
19 <meta property="og:image:alt" content="Mill Race: the opening scene of the game">
20 <meta name="twitter:card" content="summary_large_image">
21 <!-- og:end -->
22 <style>
23 :root { --ink: #1c1b19; --muted: #8b877f; --paper: #fff; --accent: #3d6f8f; }
24 * { box-sizing: border-box; }
25 html, body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; -webkit-tap-highlight-color: transparent; }
26 html, body { height: 100%; margin: 0; background: var(--paper); color: var(--ink); }
27 body { font: 13px/1.35 ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace; overflow: hidden; }
28 #stage { position: fixed; inset: 0; display: grid; place-items: center; }
29 canvas { display: block; image-rendering: pixelated; touch-action: none; cursor: pointer; outline: none; }
30 .hud { position: fixed; left: max(16px, env(safe-area-inset-left)); right: max(16px, env(safe-area-inset-right)); display: flex; justify-content: space-between; gap: 16px; pointer-events: none; }
31 #scores { position: fixed; top: max(14px, env(safe-area-inset-top)); left: max(16px, env(safe-area-inset-left)); display: grid; gap: 2px; pointer-events: none; }
32 #bottom { bottom: max(14px, env(safe-area-inset-bottom)); align-items: flex-end; }
33 .row { display: flex; align-items: center; gap: 8px; color: var(--accent); }
34 .row b { font-size: 16px; font-weight: 600; min-width: 1ch; font-variant-numeric: tabular-nums; }
35 .row span { color: var(--muted); }
36 #status { color: var(--muted); min-height: 1.35em; }
37 button { pointer-events: auto; font: inherit; color: var(--muted); background: none; border: 0; padding: 16px; margin: -16px; cursor: pointer; }
38 button:hover, button:focus-visible { color: var(--ink); }
39 </style>
40 </head>
41 <body>
42 <div id="stage"><canvas id="c" width="360" height="280" tabindex="0" aria-label="A grid of square stone channel tiles seen from above at an angle, with a sluice gate on the west edge and a water wheel on the east edge. Tap a tile to turn it a quarter, or move the cursor with the arrow keys and turn with Space, until the stream runs along the channels to the wheel and sets it turning."></canvas></div>
43 <div id="scores">
44 <div class="row"><b id="level">1/5</b><span>level</span></div>
45 <div class="row"><b id="moves">0</b><span>moves</span></div>
46 <div class="row"><b id="par">0</b><span>par</span></div>
47 <div class="row"><b id="over">0</b><span>over par in all</span></div>
48 </div>
49 <div class="hud" id="bottom">
50 <div id="status" role="status" aria-live="polite"></div>
51 <button id="mute" type="button" aria-pressed="false">sound on</button>
52 </div>
53 <script src="../shell.js"></script>
54 <script>
55 PixelPlays.mount({
56 id: 'mill-race',
57 rules: [
58 'Tap a tile, or move the cursor with the arrows and press Space, to turn it a quarter.',
59 'The arrows follow the board, not the screen: up goes up and to the right.',
60 'Join the channels from the sluice on the west to the wheel on the east.',
61 'Clear 5 levels, finishing 6 moves or fewer over par in all, to win.',
62 ],
63 });
64 </script>
65 <script>window.PP_SCENE = { originY: 10, shadowX: 1.3, shadowY: -.12 };</script>
66 <script src="../engine.js"></script>
67 <script src="race.js"></script>
68 <script>
69 'use strict';
70
71 const LAWN = [96, 138, 70], STONE = [190, 184, 172], MOSS = [112, 134, 92], MUD = [112, 92, 72];
72 const WATER = [84, 156, 214], GLINT = [150, 204, 240], WOOD = [156, 108, 64], PLANK = [196, 150, 96], IRON = [70, 66, 62];
73 const CURSOR = [255, 214, 10];
74 const STONE_H = .5, WATER_H = .38, BED_H = .05, BLANK_H = .16;
75 const HUB_Z = 1.55, RADIUS = 1.35, HOLD = 1.2, SPAN = 16;
76
77 /* ---------- state ---------- */
78 let P = MillRace.start(Date.now() & 0xffff, 1);
79 const G = { time: 0, noteUntil: 0, cx: 0, cy: 0, ang: 0, hold: null, drawn: '', frame: '', baked: 0 };
80 const nodes = {};
81 for (const k of ['level', 'moves', 'par', 'over', 'status']) nodes[k] = document.getElementById(k);
82 const shown = {};
83 function setText(key, text) {
84 if (shown[key] === text) return;
85 shown[key] = text;
86 nodes[key].textContent = text;
87 }
88 // what is drawn: the state before the clearing turn is put away while the wheel runs, then the next level
89 const view = () => (G.hold ? G.hold.state : P);
90 function renderHud() {
91 setText('level', `${P.level}/${P.last}`);
92 setText('moves', String(P.moves));
93 setText('par', String(P.par));
94 setText('over', String(P.over));
95 if (P.status !== 'playing') setText('status', `${P.line} · tap or press a key to play again`);
96 else if (G.time >= G.noteUntil) setText('status', P.line);
97 }
98 function note(text) { setText('status', text); G.noteUntil = G.time + 1.1; }
99
100 /* ---------- where the tiles are ---------- */
101 // the board is always the same size on the glass, so a tile is as big as the grid is small; k scales the wheel and flume to match
102 const tile = () => SPAN / view().size, half = () => SPAN / 2, scale = () => tile() / 2;
103 const tileOrigin = (ix, iy) => [-half() + ix * tile(), -half() + iy * tile()];
104 const centreOf = (ix, iy) => { const [x, y] = tileOrigin(ix, iy); return [x + tile() / 2, y + tile() / 2]; };
105 // the canvas point of a tile's top, which is also where a tap on it lands
106 function tilePoint(ix, iy) {
107 const [x, y] = centreOf(ix, iy), p = project(x, y, STONE_H);
108 return [p.sx, p.sy];
109 }
110 function cellAt(sx, sy) {
111 const g = unproject(sx, sy + STONE_H * COS * S), h = half(), ix = Math.floor((g.x + h) / tile()), iy = Math.floor((g.y + h) / tile());
112 const n = view().size;
113 return ix >= 0 && iy >= 0 && ix < n && iy < n ? [ix, iy] : null;
114 }
115 const fed = () => { const s = view(), w = s.wheel; return MillRace.opens(s.tiles[w.y][w.x], w.side) && s.wet.some(c => c.x === w.x && c.y === w.y); };
116
117 /* ---------- baked scene: the lawn ---------- */
118 function groundColor(x, y, ix, iy) {
119 const h = half();
120 if (x < -h - 1.6 || x > h + 3.8 || Math.abs(y) > h + .5) return 0;
121 const t = .95 + (hash(ix, iy) - .5) * .09;
122 return rgb(LAWN[0] * t, LAWN[1] * t, LAWN[2] * t);
123 }
124 function bake() {
125 ground.fill(0); shadowMask.fill(0); staticShadow.fill(0); kinds.fill(0);
126 zb.fill(-1e9);
127 pix.fill(rgb(255, 255, 255));
128 for (let iy = 0; iy < H; iy++) for (let ix = 0; ix < W; ix++) {
129 const g = unproject(ix + .5, iy + .5), i = iy * W + ix, c = groundColor(g.x, g.y, ix, iy);
130 if (!c) continue;
131 pix[i] = c; ground[i] = 1;
132 zb[i] = (g.x + g.y) / R2 * COS;
133 }
134 groundZ.set(zb);
135 bakedPix.set(pix);
136 bakedZ.set(zb);
137 G.baked = view().size;
138 }
139
140 /* ---------- the tiles ---------- */
141 const layerPix = new Uint32Array(W * H), layerZ = new Float32Array(W * H);
142 // a raised stone piece, with a shadow to the screen-right
143 function stone(x0, y0, x1, y1, h, c, seed) {
144 box(x0, y0, 0, x1, y1, h, c, seed);
145 castShadow((x0 + x1) / 2, (y0 + y1) / 2, h, (x1 - x0) * .5, 1, 0);
146 }
147 // the water pieces of this layer, so the shimmer can glint on a few of them each step without rebuilding the layer
148 const waters = [];
149 const surface = (x0, y0, x1, y1) => { waters.push([x0, y0, x1, y1]); return WATER; };
150 function drawTile(s, ix, iy, wet) {
151 const t = s.tiles[iy][ix], [ox, oy] = tileOrigin(ix, iy), TILE = tile(), SUB = TILE / 3, seed = ix * 7 + iy * 13;
152 const tone = .94 + hash(ix, iy) * .1, rock = [STONE[0] * tone, STONE[1] * tone, STONE[2] * tone];
153 if (t.type === 'blank') {
154 box(ox, oy, 0, ox + TILE, oy + TILE, BLANK_H, MOSS, seed);
155 return;
156 }
157 const open = MillRace.sides(t);
158 for (let a = 0; a < 3; a++) for (let b = 0; b < 3; b++) {
159 const x0 = ox + a * SUB, y0 = oy + b * SUB, x1 = x0 + SUB, y1 = y0 + SUB;
160 const side = a === 1 && b === 1 ? -1 : a === 1 ? (b === 0 ? 0 : 2) : b === 1 ? (a === 2 ? 1 : 3) : -2;
161 const channel = side === -1 || (side >= 0 && open.includes(side));
162 if (!channel) { stone(x0, y0, x1, y1, STONE_H, rock, seed + a * 3 + b); continue; }
163 box(x0, y0, 0, x1, y1, BED_H, MUD, seed + a);
164 if (wet) box(x0, y0, 0, x1, y1, WATER_H, surface(x0, y0, x1, y1), seed + b);
165 }
166 }
167 function drawSluice(s) {
168 const h = half(), k = scale(), cy = -h + (s.sluice.y + .5) * tile(), x0 = -h - 1.1 * k, w = tile() / 6;
169 stone(x0, cy - .85 * k, x0 + .55 * k, cy - .55 * k, 1.4, STONE, 1);
170 stone(x0, cy + .55 * k, x0 + .55 * k, cy + .85 * k, 1.4, STONE, 2);
171 box(x0, cy - .85 * k, 1.1, x0 + .55 * k, cy + .85 * k, 1.4, STONE, 3);
172 box(x0 + .55 * k, cy - w, 0, -h, cy + w, WATER_H, surface(x0 + .55 * k, cy - w, -h, cy + w), 4);
173 }
174 // the flume under the wheel, brimming when the wheel is fed and an empty bed when not
175 function drawFlume(s, on) {
176 const h = half(), k = scale(), cy = -h + (s.wheel.y + .5) * tile(), x1 = h + 3.3 * k, wx = h + 1.7 * k, w = tile() / 6;
177 box(h, cy - w - .25 * k, 0, x1, cy - w, STONE_H, STONE, 5);
178 box(h, cy + w, 0, x1, cy + w + .25 * k, STONE_H, STONE, 6);
179 castShadow(x1 - .4, cy, STONE_H, .5, 1, 0);
180 box(h, cy - w, 0, x1, cy + w, BED_H, MUD, 7);
181 if (on) box(h, cy - w, 0, x1, cy + w, WATER_H, surface(h, cy - w, x1, cy + w), 8);
182 stone(wx - .2 * k, cy - w - .3 * k, wx + .2 * k, cy - w, HUB_Z * k + .15, STONE, 9);
183 stone(wx - .2 * k, cy + w, wx + .2 * k, cy + w + .3 * k, HUB_Z * k + .15, STONE, 10);
184 }
185 function drawCursor(ix, iy) {
186 const [x, y] = tileOrigin(ix, iy), TILE = tile(), t = .12, top = STONE_H + .15;
187 box(x, y, 0, x + TILE, y + t, top, CURSOR, 11);
188 box(x, y + TILE - t, 0, x + TILE, y + TILE, top, CURSOR, 12);
189 box(x, y + t, 0, x + t, y + TILE - t, top, CURSOR, 13);
190 box(x + TILE - t, y + t, 0, x + TILE, y + TILE - t, top, CURSOR, 14);
191 }
192 // everything that holds still between turns: rebuilt only when the picture would change
193 function buildLayer() {
194 const s = view();
195 if (G.baked !== s.size) bake();
196 pix.set(bakedPix); zb.set(bakedZ);
197 waters.length = 0;
198 const wet = new Set(s.wet.map(c => c.y * s.size + c.x));
199 for (let iy = 0; iy < s.size; iy++) for (let ix = 0; ix < s.size; ix++) drawTile(s, ix, iy, wet.has(iy * s.size + ix));
200 drawSluice(s);
201 drawFlume(s, fed());
202 drawCursor(G.cx, G.cy);
203 applyShadows(bakedZ);
204 layerPix.set(pix); layerZ.set(zb);
205 }
206
207 /* ---------- the wheel ---------- */
208 // a few small glints on the water, a new few each step; none when motion is reduced
209 function drawGlints(step) {
210 if (STILL) return;
211 waters.forEach(([x0, y0, x1, y1], i) => {
212 if (hash(i + step * 7, step * 3 + 1) <= .62) return;
213 const mx = (x0 + x1) / 2, my = (y0 + y1) / 2, d = Math.min(x1 - x0, y1 - y0) * .2;
214 box(mx - d, my - d, WATER_H - .02, mx + d, my + d, WATER_H, GLINT, i);
215 });
216 }
217 function drawWheel() {
218 const s = view(), h = half(), k = scale(), cy = -h + (s.wheel.y + .5) * tile(), wx = h + 1.7 * k, wood = () => WOOD, plank = () => PLANK;
219 const hub = HUB_Z * k, radius = RADIUS * k, w = tile() / 6 - .2, r = .06 * k + .02;
220 const rim = n => { const a = G.ang + n * Math.PI / 4; return [wx + Math.cos(a) * radius, Math.sin(a) * radius + hub]; };
221 for (let n = 0; n < 8; n++) {
222 const [px, pz] = rim(n), [qx, qz] = rim(n + 1);
223 for (const dy of [-w, w]) {
224 dynamicAdd([wx, cy + dy, hub], [px, cy + dy, pz], r, r, wood);
225 dynamicAdd([px, cy + dy, pz], [qx, cy + dy, qz], r, r, wood);
226 }
227 dynamicAdd([px, cy - w, pz], [px, cy + w, pz], r * 1.6, r * 1.6, plank);
228 }
229 dynamicAdd([wx, cy - w - .4 * k, hub], [wx, cy + w + .4 * k, hub], .13 * k, .13 * k, () => IRON);
230 }
231
232 function draw() {
233 const step = STILL ? 0 : Math.floor(G.time * WIND_FPS), s = view();
234 const key = `${s.seed}|${s.level}|${s.moves}|${G.hold ? 1 : 0}|${G.cx},${G.cy}|${s.status}`;
235 if (key !== G.drawn) { G.drawn = key; buildLayer(); }
236 const frame = `${key}|${step}|${G.ang}`;
237 if (frame === G.frame) return; // nothing moved since the last frame: the canvas already shows it
238 G.frame = frame;
239 pix.set(layerPix); zb.set(layerZ);
240 drawGlints(step);
241 pendingShadows.length = 0;
242 drawWheel();
243 flushShadows();
244 applyShadows(bakedZ);
245 shadeEdges();
246 ctx.putImageData(image, 0, 0);
247 }
248
249 /* ---------- game ---------- */
250 const HINT = 'tap a tile to turn it';
251 function restart() {
252 P = MillRace.start(Date.now() & 0xffff, 1);
253 G.hold = null; G.cx = 0; G.cy = P.sluice.y; G.ang = 0;
254 note(HINT); renderHud();
255 }
256 function turnAt(ix, iy) {
257 ensureAudio();
258 if (G.hold) return;
259 if (P.status !== 'playing') { restart(); return; }
260 G.cx = ix; G.cy = iy;
261 const before = P, r = MillRace.turn(P, ix, iy);
262 if (!r.ok) { if (r.why === 'blank') { sound(130, .12, 'sawtooth'); note('solid stone'); } return; }
263 P = r.state;
264 if (r.event === 'cleared') {
265 // the picture before the new level: the turned tile, and the water the rules say it lets through
266 const tiles = before.tiles.map(row => row.map(t => ({ ...t })));
267 tiles[iy][ix].rot = (tiles[iy][ix].rot + 1) % 4;
268 const done = Object.assign({}, before, { tiles, moves: before.moves + 1 });
269 done.wet = MillRace.flow(done);
270 G.hold = { state: done, until: G.time + HOLD };
271 sound(660, .25, 'sine'); sound(990, .35, 'sine', .08);
272 note(`level cleared in ${done.moves} of par ${before.par}`);
273 } else if (r.event === 'over') {
274 sound(520, .3, 'sine'); sound(780, .5, 'sine', .15);
275 } else {
276 sound(240 + ((ix + iy) % 4) * 30, .07, 'triangle');
277 note(P.line);
278 }
279 renderHud();
280 }
281 function update(dt) {
282 G.time += dt;
283 if (G.hold && G.time >= G.hold.until) {
284 G.hold = null;
285 G.cx = Math.min(G.cx, P.size - 1); G.cy = P.sluice.y; G.ang = 0;
286 note(P.line);
287 }
288 if (fed() && !STILL) G.ang += dt * 2.4;
289 renderHud();
290 }
291
292 /* ---------- input ---------- */
293 const toCanvas = e => {
294 const r = canvas.getBoundingClientRect();
295 return { x: (e.clientX - r.left) / r.width * W, y: (e.clientY - r.top) / r.height * H };
296 };
297 canvas.addEventListener('pointerdown', () => { canvas.focus({ preventScroll: true }); });
298 canvas.addEventListener('pointerup', e => {
299 const p = toCanvas(e), c = cellAt(p.x, p.y);
300 if (c) turnAt(c[0], c[1]);
301 else if (P.status !== 'playing') restart();
302 });
303 // up is the way up the screen to the right, and so on round: the arrows turn with the picture
304 const KEYS = { ArrowUp: [0, -1], ArrowRight: [1, 0], ArrowDown: [0, 1], ArrowLeft: [-1, 0] };
305 canvas.addEventListener('keydown', e => {
306 const move = KEYS[e.key];
307 if (!move && e.key !== ' ' && e.key !== 'Enter') return;
308 e.preventDefault();
309 if (e.repeat) return;
310 ensureAudio();
311 if (move) {
312 if (P.status !== 'playing') { restart(); return; }
313 G.cx = Math.max(0, Math.min(P.size - 1, G.cx + move[0]));
314 G.cy = Math.max(0, Math.min(P.size - 1, G.cy + move[1]));
315 sound(420, .04, 'sine');
316 return;
317 }
318 turnAt(G.cx, G.cy);
319 });
320
321 /* ---------- sound ---------- */
322 let audio = null, muted = false;
323 function ensureAudio() {
324 if (audio) { if (audio.state === 'suspended') audio.resume(); return; }
325 const AC = window.AudioContext || window.webkitAudioContext;
326 if (AC) audio = new AC();
327 }
328 function sound(freq, life, type, delay = 0) {
329 if (!audio || muted) return;
330 const now = audio.currentTime + delay, gain = audio.createGain(), osc = audio.createOscillator();
331 osc.type = type;
332 osc.frequency.setValueAtTime(freq, now);
333 gain.gain.setValueAtTime(.0001, now);
334 gain.gain.exponentialRampToValueAtTime(.07, now + .01);
335 gain.gain.exponentialRampToValueAtTime(.0005, now + life);
336 osc.connect(gain).connect(audio.destination);
337 osc.start(now); osc.stop(now + life + .02);
338 }
339 const muteButton = document.getElementById('mute');
340 muteButton.addEventListener('click', () => {
341 muted = !muted;
342 muteButton.textContent = muted ? 'sound off' : 'sound on';
343 muteButton.setAttribute('aria-pressed', String(muted));
344 });
345
346 /* ---------- fit and boot ---------- */
347 addEventListener('resize', fit);
348 fit();
349 G.cy = P.sluice.y;
350 note(HINT);
351 renderHud();
352 canvas.focus({ preventScroll: true });
353 let last = performance.now();
354 function frame(now) {
355 update(Math.min(.04, (now - last) / 1000));
356 last = now;
357 draw();
358 requestAnimationFrame(frame);
359 }
360 requestAnimationFrame(frame);
361 </script>
362 </body>
363 </html>
og/home.png
Binary file not shown.
og/mill-race.png added
Binary file not shown.
rounds.mjs +8
@@ -152,6 +152,14 @@ export const ROUNDS = {
152152 if (index >= 0) { g.press(String(index + 1)); g.tap(...g.read(`scr(${x}, 9)`)); }
153153 g.run(.2);
154154 } },
155 // turn each tile of the level's laid path as far as the rules' own `scramble` says puts it right (par moves), waiting out the pause after each cleared level
156 'mill-race': { over: /play again/, outcome: /The wheel turns: 5 levels cleared, 0 moves over par/, beat: (g) => {
157 if (g.read('G.hold') || g.read('P.status') !== 'playing') { g.run(.5); return; }
158 const s = g.read('P'), plan = s.scramble.flatMap(q => Array(q.undo).fill(q));
159 const q = plan[s.moves];
160 g.tap(...g.read(`tilePoint(${q.x}, ${q.y})`));
161 g.run(.1);
162 } },
155163 // drag back for about the weight that reaches the house, then sweep while the stone runs, eight times over
156164 'curling': { over: /play again/, outcome: /You scored \d+: a (win|loss)/, limit: 240, beat: g => {
157165 if (g.read('P.stones.some(s => s.vx || s.vy)')) g.hold(...MID, .5);
serve.test.mjs +11 −2
@@ -241,9 +241,11 @@ test('every committed card is what the games render now, and capture is determin
241241 const { games, capture, card, collage } = await import('./scripts/og.mjs');
242242 const { readFileSync } = await import('node:fs');
243243 const frames = [];
244 for (const g of games()) {
244 const list = games();
245 for (const g of list) {
245246 const frame = capture(g.id);
246 expect(Buffer.from(capture(g.id)).equals(Buffer.from(frame))).toBe(true);
247 // determinism is a property of the renderer, not of a game: a second capture of the first, middle and last games proves it at a third of the cost
248 if ([0, list.length >> 1, list.length - 1].includes(list.indexOf(g))) expect(Buffer.from(capture(g.id)).equals(Buffer.from(frame))).toBe(true);
247249 frames.push(frame);
248250 expect(card(frame).equals(readFileSync(new URL(`./og/${g.id}.png`, import.meta.url)))).toBe(true);
249251 }
@@ -570,6 +572,13 @@ test('Hedge Maze and its rules script are served without a track', async () => {
570572 expect((await fetch(base + '/hedge-maze/maze.js')).status).toBe(200);
571573 });
572574
575 test('Mill Race and its rules script are served without a track', async () => {
576 const page = await fetch(base + '/mill-race/');
577 expect(page.status).toBe(200);
578 expect(page.headers.get('content-type')).toBe('text/html; charset=utf-8');
579 expect((await fetch(base + '/mill-race/race.js')).status).toBe(200);
580 });
581
573582 test('Hot Air Balloon and its rules script are served without a track', async () => {
574583 const page = await fetch(base + '/hot-air-balloon/');
575584 expect(page.status).toBe(200);
shell.js +1
@@ -59,6 +59,7 @@ window.PixelPlays = (() => {
5959 { id: 'shunting-yard', title: 'Shunting Yard', blurb: 'Shunt the wagons through the sidings until the train leaves in order', kind: 'Puzzle', input: 'Tap', accent: '#8a4b2f', music: false, forged: true },
6060 { id: 'ferris-wheel', title: 'Ferris Wheel', blurb: 'Seat the queue without tipping the wheel', kind: 'Strategy', input: 'Tap', accent: '#b8475a', music: false, forged: true },
6161 { id: 'hedge-maze', title: 'Hedge Maze', blurb: 'Find the way through the hedges to the fountain before the gardener rings the bell', kind: 'Puzzle', input: 'Keys', accent: '#3d6e4f', music: false, forged: true },
62 { id: 'mill-race', title: 'Mill Race', blurb: 'Turn the channels until the stream reaches the mill wheel', kind: 'Puzzle', input: 'Tap', accent: '#3d6f8f', music: false, forged: true },
6263 { id: 'bunting', title: 'Bunting', blurb: 'Hang the flags for the fete so no two neighbours match', kind: 'Strategy', input: 'Tap', accent: '#3d7f6e', music: false, forged: true },
6364 ];
6465 const MUSIC_VOLUME = .4;

↑↓ navigate ↵ open ⌘↵ its app esc close

Keyboard shortcuts

Docs