diff --git a/CLAUDE.md b/CLAUDE.md index f45f749..beaefa3 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -89,7 +89,9 @@ a new game or a change keeps to them. never selects another board; a double tap brings one in; a tap on the board you are on is the game's. A long press does nothing to the bottom row (Nov 22; Minesweeper keeps its flag): the dots open it, its × shuts it. A double click on the board you are on shows it full screen and playable, alone (Dec 1, `focusOpen`, `docs/field.md`); a double click or - Escape goes back. An app that takes the double itself keeps it; the labs show theirs in their own view (`soloOnDouble`). + Escape goes back. Every game does the same; a game takes the double click for itself (`noDoubleTap`) only for a very good reason + (Dec 1: real-time play where two quick taps on one spot are two moves, as Simon, Whack-a-mole, Blockout, pinball, Pong; or an editor), + never because its taps can come fast at the player's own pace. The labs show theirs in their own view (`soloOnDouble`). No full screen button. - **Games play with the row shut.** The row never opens by itself; what a gesture cannot do goes on the play pad (`playActs`). An editor's row is opened by its ✎ or menu item. Small tools always at hand (a palette, undo) go on the tool bar (`toolTiles`, `onToolTap`, Nov 26): icons only, chips in the diff --git a/docs/field.md b/docs/field.md index d620745..b059fee 100644 --- a/docs/field.md +++ b/docs/field.md @@ -854,3 +854,16 @@ Four of smoke part 1's checks had been failing since the Nov 28 changes, on `mai Also measured the same day (part 4 failing under load after the full screen's change, passing alone): blockout's and Soma's frames over 20 s, today's page against the one before the day's changes, two rounds each: blockout 2.4 against 3.0–3.6 s a frame in the software renderer, Soma 73–75 against 119–147 ms. No frame is slower; the failures under load were the load's. +- **The double click is full screen in every game** (1 Dec 2026, the same evening: "remove the full screen icons from all games. every game + should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it + needs to be a very good reason."). The ⛶ chip is gone. Of the 22 games that kept the double click (`noDoubleTap`), the nine played at their + own pace gave it up, since a second tap a moment later is still a tap there: Lights Out, Sudoku, Nonograms, Hashi, Bejeweled, the block + builder, the flash cards, the tanks, and Soma's play. Those keeping it, each for a very good reason: real-time play where two quick taps on one + spot are two moves (Blockout's spins, Simon's pad pressed twice running in its timed sequence, Whack-a-mole's whacks, pinball's flippers, + Pong's, air hockey's and squash's paddles, Board War's two shots, marble run's tiles turned as the marble rolls); trick shots, whose view stands + behind the white and is never the board's own place; the game lab; and the editors (Soma's editor and gallery, the tiles', the tilt maze's, + pinball's). Part 5's check: Sudoku with a puzzle under way, a real double click full screen and no ⛶ anywhere, Escape back; Simon keeps its. + The checks that tapped those games quickly on one square (Lights Out's five presses, Nonograms', Sudoku's and Hashi's four) now tap at a + player's pace, past a double's 400 ms, and check the board did not go full screen; Sudoku's and Hashi's also wait past the check before's last + click, which landed on the same square 160 ms earlier and made a true double. Part 7's "double tap off default" now has Lights Out giving the + double click up. Each touch tap reaches the field once (checked: no tap is read twice by its pointer and touch events). diff --git a/games.html b/games.html index e19ddc8..fa0ae68 100644 --- a/games.html +++ b/games.html @@ -14036,17 +14036,9 @@ if (L && L.length){ _toolBarLast = { app: a, L }; } else if (_toolBarLast && _toolBarLast.app === a) L = _toolBarLast.L.map(q => ({ ...q, on: false, dim: true, idle: true })); else _toolBarLast = null; - /* A FULL SCREEN CHIP, WHERE THE DOUBLE CLICK IS THE GAME'S (Dec 1, "What's next", then "1 3": "A full-screen button … for games that keep the - double click for themselves"). A game that takes the double click for its own play (`noDoubleTap()` saying so now, as Sudoku, Simon, - Lights Out and Whack-a-mole do while a board is in play, or an editor while it is open; or `onDoubleTap`) cannot reach THE BOARD YOU ARE ON, FULL SCREEN by it, so the field puts one - chip of its own at the end of the game's ring: ⛶, pressed (draw's gold) while the board is full screen; a press goes in or comes back. It is - the field's, not the game's (`field`), so the game's own chips keep their numbers. The labs, with their own view, and the games whose double - click is the field's have none. */ - let _dblGame = false; try { _dblGame = !!(a && (a.onDoubleTap || (a.noDoubleTap && a.noDoubleTap()))); } catch {} - // (shown while the double click is the game's now, and while the board is full screen, so there is always a way back) - if (a && f && !a.soloOnDouble && (_dblGame || FOCUS.on)){ - L = (L || []).concat([{ glyph: '⛶', title: FOCUS.on ? 'Leave full screen' : 'This board full screen', on: FOCUS.on, field: 'focus' }]); } - const sig = L && L.length ? L.map(q => q.glyph + '|' + (q.title || '') + (q.on ? '+' : '') + (q.dim ? '-' : '') + (q.idle ? '~' : '') + (q.field || '')).join(',') : ''; + /* (A FULL SCREEN CHIP for games that kept the double click, Dec 1, went the same day: "remove the full screen icons from all games. every game + should do handle double click the same by going to full screen." The games that kept it for no very good reason gave it up instead.) */ + const sig = L && L.length ? L.map(q => q.glyph + '|' + (q.title || '') + (q.on ? '+' : '') + (q.dim ? '-' : '') + (q.idle ? '~' : '')).join(',') : ''; if (sig === _toolBarSig) return; _toolBarSig = sig; const ring = document.getElementById('gameBar'); if (!ring) return; @@ -14057,13 +14049,12 @@ L.forEach((q, i) => { const b = document.createElement('button'); b.type = 'button'; b.className = 'panel chip tchip'; b.dataset.i = i; b.addEventListener('click', e => { e.stopPropagation(); if (b.dataset.idle === '1') return; // (a button kept while its game gives none: nothing to do) - if (b.dataset.field === 'focus'){ if (FOCUS.on) focusClose(); else focusOpen(); _toolBarSig = null; try { toolBarTick(window.getFieldApp && window.getFieldApp()); } catch {} try { restWake(); } catch {} return; } try { const a2 = window.getFieldApp && window.getFieldApp(), f2 = bbFramedCell(); if (a2 && a2.onToolTap && f2) a2.onToolTap(f2.c, f2.r, +b.dataset.i); } catch (err){ _reportError('tool bar', err); } _toolBarSig = null; try { toolBarTick(window.getFieldApp && window.getFieldApp()); } catch {} try { restWake(); } catch {} }); ring.appendChild(b); old.push(b); }); } L.forEach((q, i) => { const b = old[i]; b.textContent = q.glyph; b.title = q.title || ''; b.setAttribute('aria-label', b.title); - b.setAttribute('aria-pressed', q.on ? 'true' : 'false'); b.classList.toggle('dim', !!q.dim); b.dataset.idle = q.idle ? '1' : ''; b.dataset.field = q.field || ''; }); + b.setAttribute('aria-pressed', q.on ? 'true' : 'false'); b.classList.toggle('dim', !!q.dim); b.dataset.idle = q.idle ? '1' : ''; }); try { window.__gameRing && window.__gameRing.layout(); } catch {} } let _bbQuickSig = null; @@ -34053,7 +34044,7 @@ onReset(c, r){ if (DEMO && DEMO.c === c && DEMO.r === r) DEMO = null; if (GAL.on && GAL.c === c && GAL.r === r) GAL.on = false; GAMES.set(gkey(c, r), fresh(c, r)); LIVE = { c, r }; touched(); return true; }, onSelect(c, r){ return true; }, onFramed(c, r){ LIVE = c == null ? null : { c, r }; if (c != null){ const g = gameAt(c, r); countSoon(g.F); } }, - noDoubleTap(){ return ED.on || GAL.on ? 'always' : !!liveGame(); }, + noDoubleTap(){ return ED.on || GAL.on ? 'always' : false; }, // (its editor and gallery keep it; its play no longer does (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) // two fingers twisted turn the piece in hand about the upright, a quarter turn each TWIST_STEP degrees (the field's twist) // (a twist begun on the piece in hand, or its shadow in the figure, turns the piece; any other turns the view, as in every other // game: Oct 24, "two finger rotate does not work for some applications, such as soma.", when every twist took the piece) @@ -34916,7 +34907,7 @@ onReset(c, r){ restart(c, r); return true; }, onSelect(c, r){ return true; }, onFramed(c, r){ LIVE = (c == null) ? null : { key: gkey(c, r), c, r }; }, - noDoubleTap(){ const g = liveGame(); return !!(g && g.state === 'play'); }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) statTiles(c, r){ return tilesOf(c, r); }, onStatTap(c, r, i){ if (i === 0){ restart(c, r); return true; } @@ -53978,7 +53969,7 @@ /* (Oct 15, Simon's lesson: "the simon buttons are very hard to push".) Two quick presses on one square are an ordinary thing here (pressed by mistake, pressed back), and the field read the second as a double-tap, which reframes the view and never reaches the game. While the framed board is not yet out, every tap is a press. */ - noDoubleTap(){ const g = liveGame(); return !!g && !g.done; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ LIVE = { c, r }; const g = gameAt(c, r); @@ -54150,7 +54141,7 @@ onReset(c, r){ GAMES.set(gkey(c, r), fresh(c, r)); LIVE = { c, r }; return true; }, onSelect(c, r){ return true; }, onFramed(c, r){ LIVE = c == null ? null : { c, r }; }, - noDoubleTap(){ const g = liveGame(); return !!g && !g.done; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ LIVE = { c, r }; const g = gameAt(c, r); @@ -54901,7 +54892,7 @@ /* (Oct 15, Simon: "the simon buttons are very hard to push".) Two quick taps on one square, filling and clearing it, or filling two squares side by side, read as a double-tap, which reframes the view and never reaches the game. While a puzzle is on the framed board every tap is a tap. */ - noDoubleTap(){ const g = liveGame(); return !!g && g.state !== 'solved'; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ // (the tap the field still calls at the end of a short drag: the drag has done what it meant, as in golf's editor) if (DRAG && DRAG.moved){ DRAG = null; return true; } @@ -55546,7 +55537,7 @@ /* (Oct 15, Simon: "the simon buttons are very hard to push".) A digit tapped twice in a row (put in, taken out) or two squares tapped quickly read as a double-tap, which reframes the view and never reaches the game. While a puzzle is on the framed board every tap is a tap. */ - noDoubleTap(){ const g = liveGame(); return !!g && g.state !== 'solved'; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ const live = !!LIVE && LIVE.c === c && LIVE.r === r; LIVE = { c, r }; @@ -56194,7 +56185,7 @@ onFramed(c, r){ LIVE = c == null ? null : { c, r }; }, /* (Oct 15, Simon: "the simon buttons are very hard to push".) Two quick taps on an island and the next, or on one pair twice, read as a double-tap, which reframes the view and never reaches the game. While a puzzle is on the framed board every tap is a tap. */ - noDoubleTap(){ const g = liveGame(); return !!g && g.state !== 'solved'; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ // (the tap the field still calls at the end of a short drag: the drag has done what it meant, as in Nonograms) if (DRAG && DRAG.moved){ DRAG = null; return true; } @@ -56704,7 +56695,7 @@ LIVE = c == null ? null : { c, r }; }, // (two quick taps on the framed card are a turn and a grade, never the field's double tap) - noDoubleTap(){ return !!LIVE; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ const was = LIVE && LIVE.c === c && LIVE.r === r; LIVE = { c, r }; @@ -57836,7 +57827,7 @@ LIVE = c == null ? null : { c, r }; if (LIVE && !TOLD){ TOLD = true; say('Your tank is on the left. Tap or drag on the board to aim: the dots show where the shell goes. Tap your tank (or Enter) to fire. The buttons on the right choose a shell and drive. Arrows aim, A and D drive, 1–6 choose a shell.', 6000); } }, - noDoubleTap(){ const g = liveGame(); return !!g && g.state !== 'over'; }, + // (no noDoubleTap any more (Dec 1: "every game should do handle double click the same by going to full screen. if there is a good reason a game needs to take control of double click,it needs to be a very good reason.": played at its own pace, a second tap a moment later is a tap, so the double click is the field's, the board full screen)) onCellTap(c, r, u, v){ if (performance.now() - ateAt < 400) return true; // (the tap the field still calls after a short drag) LIVE = { c, r }; diff --git a/tests/part4.mjs b/tests/part4.mjs index 9308a67..91d0667 100644 --- a/tests/part4.mjs +++ b/tests/part4.mjs @@ -1309,8 +1309,9 @@ try { const ok2 = real && real.moves === 3 && real.got.every(g => g.changed === g.want); if (!ok2) failures.push('[lightsout] real clicks: ' + JSON.stringify({ fc, real })); console.log(`${ok2 ? 'ok ' : 'FAIL'} lightsout: three real clicks flip the cross about each square clicked, corner and edge too`); - // five quick real touches on one square are five presses, each a flip (Simon's lesson: a quick second tap on one spot - // was read as a double-tap and never reached the game) + // five real touches on one square are five presses, each a flip (Simon's lesson; since Dec 1, "every game should do handle double click the + // same by going to full screen", Lights Out no longer keeps the double click, so the touches come at a player's own pace, past a double's + // 400 ms, and none opens the full screen) await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: true }); const quick = await page.evaluate(async () => { const A = window.getFieldApp(), D = A._debug, W = window.FIELD_WORLD, f = W.cellAt(W.target.boardX, W.target.boardZ); @@ -1322,12 +1323,12 @@ try { const tap = async (u, v, after) => { const p = S(u, v); ptr('pointerdown', p); const t = mk(p); fire('touchstart', t); ptr('pointerup', p); fire('touchend', t); await wait(after); }; const g = D.fresh(f.c, f.r); D.GAMES.set(f.c + '_' + f.r, g); D.LIVE = { c: f.c, r: f.r }; const n = g.n, i = 1 * n + 1, start = g.S.start, seen = []; - for (let k = 0; k < 5; k++){ await tap((1 + 0.5) / n, (1 + 0.5) / n, 200); seen.push(g.L.some((v, j) => v !== start[j]) ? 1 : 0); } + for (let k = 0; k < 5; k++){ await tap((1 + 0.5) / n, (1 + 0.5) / n, 550); seen.push(g.L.some((v, j) => v !== start[j]) ? 1 : 0); } const cross = D.crossOf(n, i), odd = Array.from(g.L).every((v, j) => v === (cross.includes(j) ? 1 - start[j] : start[j])); - return { moves: g.moves, seen: seen.join(''), odd, noDbl: A.noDoubleTap() }; + return { moves: g.moves, seen: seen.join(''), odd, noDbl: !window.fieldFocus.on }; }); await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: false }); - const ok3 = quick.moves === 5 && quick.seen === '10101' && quick.odd; + const ok3 = quick.moves === 5 && quick.seen === '10101' && quick.odd && quick.noDbl; if (!ok3) failures.push('[lightsout] quick taps on one square: ' + JSON.stringify(quick)); console.log(`${ok3 ? 'ok ' : 'FAIL'} lightsout: five quick real touches on one square are five presses (${quick.moves}), flipping it each time (${quick.seen})`); // a board no one plays presses its own way out, one square at a time @@ -2167,9 +2168,9 @@ try { D.MODE = 'fill'; const g = D.fresh(f.c, f.r); D.GAMES.set(f.c + '_' + f.r, g); D.LIVE = { c: f.c, r: f.r }; const i = g.P.n + 1, [u, v] = D.centreOf(g.P, i), seen = []; - for (let k = 0; k < 4; k++){ await tap(u, v, 200); seen.push(g.cells[i]); } + for (let k = 0; k < 4; k++){ await tap(u, v, 550); seen.push(g.cells[i]); } const f2 = W.cellAt(W.target.boardX, W.target.boardZ); - return { seen, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: window.getFieldApp().noDoubleTap() }; + return { seen, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: !window.fieldFocus.on }; }); await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: false }); const ok3 = quick.seen.join() === '1,0,1,0' && quick.still && quick.noDbl; diff --git a/tests/part5.mjs b/tests/part5.mjs index 8e37cf1..32f8a9c 100644 --- a/tests/part5.mjs +++ b/tests/part5.mjs @@ -920,6 +920,7 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2), console.log(`${ok2 ? 'ok ' : 'FAIL'} sudoku: real clicks select a square and put a digit in (a given stays), the same digit again takes it out, the keys, arrows and the play pad work, a real click finishes it and another starts it again`); // (Oct 15, Simon's lesson) quick real touches on one digit with a square selected are each a tap: in, out, in, out, and the view never reframed await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: true }); + await page.waitForTimeout(600); // (Dec 1: past a double's 400 ms from the check before's last click, which can be on the same square: two clicks there now show the board full screen) const quick = await page.evaluate(async () => { const D = window.getFieldApp()._debug, W = window.FIELD_WORLD, f = W.cellAt(W.target.boardX, W.target.boardZ); const S = (u, v) => { const T = W.target, bW = W.boardW(), L = window.LAB || {}; const p = new W.THREE.Vector3(T.boardX + (0.5 - u) * bW * (L.cellW || 1), 0.02, T.boardZ + (0.5 - v) * bW * (L.cellH || 1)).project(W.camera); return [(p.x + 1) / 2 * innerWidth, (1 - p.y) / 2 * innerHeight]; }; @@ -931,10 +932,10 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2), const g = D.fresh(f.c, f.r); D.GAMES.set(f.c + '_' + f.r, g); D.LIVE = { c: f.c, r: f.r }; const i = g.P.givens.findIndex(x => !x), d = g.P.sol[i], seen = []; const [cu, cv2] = D.centreOf(g.P, i), [du, dv] = D.digitAt(g.P, d); - await tap(cu, cv2, 200); - for (let k = 0; k < 4; k++){ await tap(du, dv, 200); seen.push(g.v[i]); } + await tap(cu, cv2, 550); + for (let k = 0; k < 4; k++){ await tap(du, dv, 550); seen.push(g.v[i]); } const f2 = W.cellAt(W.target.boardX, W.target.boardZ); - return { seen, d, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: window.getFieldApp().noDoubleTap() }; + return { seen, d, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: !window.fieldFocus.on }; }); await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: false }); const ok3 = quick.seen.join() === [quick.d, 0, quick.d, 0].join() && quick.still && quick.noDbl; @@ -1258,6 +1259,7 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2), console.log(`${ok2 ? 'ok ' : 'FAIL'} hashi: real clicks select an island and bridge it to the next, the sea between them steps the pair, a real drag lays two bridges, the keys and the play pad work, a real click finishes it and another starts it again`); // (Oct 15, Simon's lesson) quick real touches alternating between two islands are each a tap: select, one bridge, two, none, and the view never reframed await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: true }); + await page.waitForTimeout(600); // (Dec 1: past a double's 400 ms from the check before's last click, which can be on the same square: two clicks there now show the board full screen) const quick = await page.evaluate(async () => { const D = window.getFieldApp()._debug, W = window.FIELD_WORLD, f = W.cellAt(W.target.boardX, W.target.boardZ); const S = (u, v) => { const T = W.target, bW = W.boardW(), L = window.LAB || {}; const p = new W.THREE.Vector3(T.boardX + (0.5 - u) * bW * (L.cellW || 1), 0.02, T.boardZ + (0.5 - v) * bW * (L.cellH || 1)).project(W.camera); return [(p.x + 1) / 2 * innerWidth, (1 - p.y) / 2 * innerHeight]; }; @@ -1274,7 +1276,7 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2), await tap(au, av, 200); seen.push(g.b[e]); await tap(bu, bv, 200); seen.push(g.b[e]); const f2 = W.cellAt(W.target.boardX, W.target.boardZ); - return { seen, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: window.getFieldApp().noDoubleTap() }; + return { seen, still: !!f2 && f2.c === f.c && f2.r === f.r, noDbl: !window.fieldFocus.on }; }); await cdp.send('Emulation.setTouchEmulationEnabled', { enabled: false }); const ok3 = quick.seen.join() === '0,1,2,0' && quick.still && quick.noDbl; @@ -2098,31 +2100,27 @@ const game = { title: 'Words', size: l => 5 + Math.ceil(l / 2), console.log(`${ok ? 'ok ' : 'FAIL'} ${id}, a double click on the board you are on shows it full screen: ${on.on ? 'on' : 'off'}, the menu ${on.menu}; taps reaching the game ${taps}; ${id === 'tetris' ? 'Escape' : 'a double click'} back: ${off.on ? 'still on' : 'off'}`); } - // (Dec 1, "1 3": a full screen chip where the double click is the game's): Sudoku in play keeps its double clicks, so the ring carries the field's - // ⛶; a real press shows the board full screen (the chip pressed), a real tap on the board is still Sudoku's, and the chip again brings it back; - // checkers, whose double click is the field's, has no such chip + // (Dec 1: "remove the full screen icons from all games. every game should do handle double click the same by going to full screen."): Sudoku with + // a puzzle under way no longer keeps the double click, so a real double click shows the board full screen, and no game's ring has a ⛶; Simon, + // whose pads are pressed twice running in its timed sequence, keeps it (a very good reason) { current = 'sudoku'; await page.evaluate(() => window.setFieldApp(window.FIELD_APPS.find(a => a.id === 'sudoku'))); await drawn(page, 2500); await page.evaluate(() => window.__settle()); let p = await page.evaluate(() => window.__aim(9, 4, 4)); await page.mouse.click(p.x, p.y); await drawn(page, 1200); - const chip = () => page.evaluate(() => { const b = [...document.querySelectorAll('#gameBar > .tchip')].find(x => x.dataset.field === 'focus'); if (!b) return null; const r = b.getBoundingClientRect(); - return { x: r.x + r.width / 2, y: r.y + r.height / 2, on: b.getAttribute('aria-pressed') === 'true', seen: r.width > 0 }; }); - let c = null; for (let k = 0; k < 12 && !(c && c.seen); k++){ c = await chip(); if (!(c && c.seen)) await drawn(page, 400); } - const out = { live: await page.evaluate(() => !!window.getFieldApp().noDoubleTap()), chip: !!(c && c.seen) }; - if (c && c.seen){ await page.mouse.click(c.x, c.y); await drawn(page, 2000); out.on = await page.evaluate(() => window.fieldFocus.on); out.pressed = (await chip() || {}).on; - await page.evaluate(() => { const A = window.getFieldApp(); window.__taps = 0; window.__tapOrig = A.onCellTap; A.onCellTap = function(...a){ window.__taps++; return window.__tapOrig.apply(this, a); }; }); - p = await page.evaluate(() => window.__aim(9, 5, 5)); await page.mouse.click(p.x, p.y); await drawn(page, 800); - out.taps = await page.evaluate(() => { window.getFieldApp().onCellTap = window.__tapOrig; return window.__taps; }); - const c2 = await chip(); if (c2) await page.mouse.click(c2.x, c2.y); await drawn(page, 1500); out.off = await page.evaluate(() => !window.fieldFocus.on); } - current = 'checkers'; - await page.evaluate(() => window.setFieldApp(window.FIELD_APPS.find(a => a.id === 'checkers'))); await drawn(page, 2000); - out.checkers = !(await chip()); - const ok = out.live && out.chip && out.on && out.pressed && out.taps >= 1 && out.off && out.checkers; - if (!ok) failures.push('[full screen chip] ' + JSON.stringify(out)); - console.log(`${ok ? 'ok ' : 'FAIL'} the full screen chip: Sudoku in play carries it (${out.chip}), a real press shows the board full screen (${out.on}, pressed ${out.pressed}), a tap still Sudoku's (${out.taps}), pressed again back (${out.off}); checkers without it (${out.checkers})`); + const out = { live: await page.evaluate(() => !!(window.getFieldApp().running && window.getFieldApp().running())), keeps: await page.evaluate(() => !!(window.getFieldApp().noDoubleTap && window.getFieldApp().noDoubleTap())) }; + await page.evaluate(() => window.__settle()); + p = await page.evaluate(() => window.__aim(9, 2, 2)); await page.mouse.dblclick(p.x, p.y); await drawn(page, 2000); + out.full = await page.evaluate(() => window.fieldFocus.on); + out.chip = await page.evaluate(() => [...document.querySelectorAll('#gameBar > .tchip')].some(b => b.textContent === '⛶')); + await page.keyboard.press('Escape'); await drawn(page, 1200); out.back = await page.evaluate(() => !window.fieldFocus.on); + current = 'simon'; + await page.evaluate(() => window.setFieldApp(window.FIELD_APPS.find(a => a.id === 'simon'))); await drawn(page, 1500); + out.simonKeeps = await page.evaluate(() => typeof window.getFieldApp().noDoubleTap === 'function'); + const ok = !out.keeps && out.full && !out.chip && out.back && out.simonKeeps; + if (!ok) failures.push('[double click full screen] ' + JSON.stringify(out)); + console.log(`${ok ? 'ok ' : 'FAIL'} Sudoku with a puzzle under way: a real double click shows it full screen (${out.full}), no ⛶ chip (${!out.chip}), Escape back (${out.back}); Simon keeps its double clicks (${out.simonKeeps})`); } - } catch (e){ failures.push(`[${current}] ${e.message}`); } diff --git a/tests/part7.mjs b/tests/part7.mjs index 7cf88b5..be49947 100644 --- a/tests/part7.mjs +++ b/tests/part7.mjs @@ -544,7 +544,8 @@ try { r.back = await fd(); out[id] = r; } - if (!Object.values(out).every(r => r.at && r.kept && !r.moved && r.back)) failures.push(`[${current}] ${JSON.stringify(out)}`); + // (Dec 1: Lights Out no longer keeps the double click, "every game should do handle double click the same"; Pong and pinball still take every press) + if (!Object.entries(out).every(([id, r]) => r.at && (id === 'lightsout' ? !r.kept : r.kept) && !r.moved && r.back)) failures.push(`[${current}] ${JSON.stringify(out)}`); console.log(`${failures.length === before ? 'ok ' : 'FAIL'} double tap off default (Lights Out, Pong and pinball, a game under way and the view zoomed by the real wheel: a real double tap put the board back where the 0 key does)`); } {