WikiWayne
Local AIWikiBenchGamesPrompt LabGrok BotAI ToolsTech NewsAboutBlogContact

As an Amazon Associate I earn from qualifying purchases. This site contains affiliate links.

WikiWayne

Independent notes on local AI, real hardware, Grok, and the games that come out of that stack.

Categories

  • Local AI Hub
  • Local AI Glossary
  • Local AI
  • AI Tools
  • Tech News

Quick Links

  • About Wayne
  • Games
  • Grok Bot
  • Contact
  • Links
  • ADHD MaxxxingSponsored
  • WikiBench
  • Methodology
  • Editorial Standards
  • Disclosures
  • Privacy Policy
  • Sitemap

Follow on X

Hardware, local models, Grok, and what I actually ship.

Follow @wikiwayne
WikiWayne© 2026
PrivacyWikiBenchMethodologyEditorialDisclosuresTermsSitemap
Home/Prompt Lab/Pocket Sheet

Pocket Sheet

PL-192Very HardPage layouts & UIHTML/CSS

A tokenizer, parser and evaluator with dependency and cycle handling, capped undo history and exact counters.

Pocket Sheet
Download fileMade for ChatGPT, Claude, Gemini, Grok and other AI tools

How to run

  1. Download the file or copy the prompt.
  2. Upload or paste it into any AI chat or coding tool, and send.
  3. Save the HTML it gives you as a file and open it in Chrome.
  4. Open it with ?test=1 and look in the browser console for the TEST lines.

What it tests

A tokenizer, parser and evaluator with dependency and cycle handling, capped undo history and exact counters.

The checks

Show the 5 checks
  1. After attract(false) at t = 0: stats() has edits, undos, redos, recalcs, undoDepth, redoDepth, errorCells, buzzes, loops and soundTriggers all 0, selected "B2" and editing false; the editor's value is "42"; cell(ref).display is "Lemonade" for A2, "42" for B2, "238" for G2, "47.6" for H2, "11" for H4, "130" for B7, "183" for F7, "752" for G7, "30.08" for H7 (cell("H7").value within 1e-9 of 30.08), "42" for B8, "238" for G8, "12" for B9, "8" for F9, "55" for G9, "2.5" for B10, "1880" for B11 and "" for A12 (value null); cell("B7").raw is "=SUM(B2:B6)"; at 1280x720 layout() has toolbar h 52, formulaBar y 52 and h 44, grid x 268, y 96, w 744 and h 564 and status y 660 (each within 2), rect("B2") is x 396, y 176, w 88, h 44 (each within 2), and the grid height is at least 0.75 of 720; at 390x844 layout().grid is x 0, y 96, w 744, h 564 (each within 2), its height is between 0.64 and 0.70 of 844, rect("B2") is x 128, y 176, w 88, h 44 (each within 2) and layout().scrollWidth is at most 390; the undo and redo buttons are each at least 44 x 44.
  2. After attract(false), commit each text below in turn into B12 with edit("B12", text) and compare cell("B12").display (the value is the number, or the text, or null; error is null except for errors); the texts are quoted and separated by semicolons. Numbers and text: "42" gives 42; "-3.5" gives -3.5; "hello" gives hello (text). Formulas: "=1+2*3" gives 7; "=(1+2)*3" gives 9; "=10-4-3" gives 3; "=100/4/5" gives 5; "=-2*-3" gives 6; "=2*-(1+2)" gives -6; "=B2+C2" gives 80; "=b2*c2" gives 1596; "=SUM(B2:F2)" gives 238; "=sum(b2:f2)/5" gives 47.6; "=AVG(B2:C3)" gives 34; "=MIN(B2:F6)" gives 8; "=MAX(B2:F6)" gives 60; "=SUM(B2:B6, 100, C2*2)" gives 306; "=SUM(F2:B2)" gives 238; "=SUM(A2:A6)" gives 0; "=MAX(A2:A6)" gives 0; "=SUM(B2)" gives 42; "=SUM(A2)" gives 0; "=MAX(B2:B6)-MIN(B2:B6)" gives 30; "=SUM(1,MAX(B2:B3))" gives 43; "=B10*B2" gives 105; "=B2/B4*3" gives 10.5; "=0-0" gives 0; "=-0*5" gives 0; "=12345678" gives 12345678; "=1/3" gives 0.33; "=2/3" gives 0.67; "=0.1+0.2" gives 0.3; "=1234567.891" gives 1.23e+6 (its value within 1e-6 of 1234567.891). Errors (display and error both equal the error value): "=AVG(A2:A6)", "=1/0", "=SUM(B2:F2)/0" and "=1/0+J1" give #DIV/0!; "=B13", "=J1", "=A0", "=SUM(A1:J3)" and "=J1+1/0" give #REF!; "=A2+1", "=1+", "=SUM()", "=SUM(B2:C3", "=B2:C3", "=FOO(1)", "=2 3" and "=" give #ERR!. Also edit("B12", "= 1 + 2 ") returns true and leaves cell("B12").raw as "= 1 + 2" with display 3, and edit("B12", "= 1 + 2") then returns false; a text of 37 characters is refused (edit returns false, raw unchanged) while one of exactly 36 characters is accepted.
  3. After attract(false): edit("B2", "50") makes G2 246, H2 49.2, B7 138, G7 760, H7 30.4, B8 50, G8 246, H8 49.2 and B11 1900. Then edit B12 "=C12+1", C12 "=D12+1", D12 "=B7" gives B12 140, C12 139, D12 138; edit("B3", "30") makes B7 143, D12 143, C12 144, B12 145, G3 164 and H3 32.8 (each cell shows these displays right after the edit, with no extra frame or event). Then edit C12 "=B12+1" makes B12 and C12 "#CYCLE!" (errorCells 2, D12 still 143); edit D12 "=B12*2" and E12 "=SUM(B12:D12)" make D12 and E12 "#CYCLE!" (errorCells 4); edit F12 "=B7+1" shows 144; edit C12 "7" repairs everything: B12 8, C12 7, D12 16, E12 31, errorCells 0. Then edit A12 "=SUM(A1:A12)" shows #CYCLE! (errorCells 1) and edit A12 "=SUM(A1:A11)" shows 0 (errorCells 0). Then a real click (pointerdown, pointerup) at the center of rect("B2") makes stats().selected "B2" and a real keydown "Delete" clears it: cell("B2").raw is "", display "", G2 196, H2 49, B7 93 and B11 1787.5. Then edit G12 "=B2+1" shows 1 and edit H12 "=AVG(B2:B2)" shows #DIV/0!. At the end stats() has edits 15, recalcs 15, undos 0, redos 0, undoDepth 15, redoDepth 0, errorCells 1, buzzes 5 and soundTriggers 20.
  4. After attract(false): undo() and redo() both return false. Real click at the center of rect("C3") gives selected "C3"; real keydowns ArrowDown, ArrowRight, ArrowUp, ArrowLeft give "C4", "D4", "D3", "C3"; five more ArrowUp give "C1" and five ArrowLeft give "A1" (the edges stop it). Then for each of B12 "1", C12 "2", D12 "3": a real click at the center of that cell's rect(), a real keydown of the single character, then a real keydown "Enter" (the editor's value is that character right after the first keydown and stats().editing is true; the cell's raw is still "" until Enter; after Enter editing is false and the cell holds the text); stats().edits is 3, undoDepth 3. A real click on A12, keydown "9" then keydown "Escape": editing false, the editor shows "", A12 raw "", edits 3; keydown "Delete" on that empty cell changes nothing (edits 3); edit("D12", "3") returns false. A keydown "z" with metaKey true empties D12 (undos 1, undoDepth 2, redoDepth 1, recalcs 4); a keydown "Z" with ctrlKey and shiftKey restores D12 "3" (redos 1, redoDepth 0, recalcs 5); two keydowns "z" with ctrlKey empty D12 and C12 (undos 3, undoDepth 1, redoDepth 2, recalcs 7); a keydown "y" with ctrlKey restores C12 "2" (redos 2, redoDepth 1, recalcs 8); a real click on A12 then keydown "4" and "Enter" commits A12 "4" (edits 4, redoDepth 0, undoDepth 3, recalcs 9); a real click on the UNDO button (center of layout().undoButton) empties A12 (undos 4, recalcs 10) and one on the REDO button restores it (redos 3, recalcs 11, undoDepth 3). Then edit("A12", String(i)) for i = 1 to 60: undoDepth is 50 and edits 64 (the first 10 of these were pushed off the list). Then call undo() 60 times: exactly the first 50 return true, A12's raw is "10", undoDepth 0, redoDepth 50, undos 54; then redo() 60 times: exactly the first 50 return true, A12's raw is "60", undoDepth 50, redoDepth 0, redos 53; B12, C12 and D12 hold "1", "2" and "" through the last three steps; at the end recalcs is 171.
  5. Fresh load with the demo running, advance() frame by frame to each time (frames = 60 x t) and read stats() and cells (the six numbers are edits, undos, redos, undoDepth, redoDepth, errorCells): t = 2.2: 1, 0, 0, 1, 0, 0 and B2 shows 48; t = 3.75: selected "D4", editing true, the editor's value "=B4*2", cell D4 raw still "15", edits 1; t = 4.2: 2, 0, 0, 2, 0, 0, editing false and D4 shows 24; t = 6.2: 3, 0, 0, 3, 0, 0, B11 shows 2301; t = 8.2: 4, 0, 0, 4, 0, 1, B12 shows #CYCLE!; t = 10.2: 5, 0, 0, 5, 0, 2; t = 12.2: 6, 0, 0, 6, 0, 3 and D12 shows #CYCLE!; t = 14.2: 7, 0, 0, 7, 0, 4 and E12 shows #REF!; t = 16.2: 7, 1, 0, 6, 1, 3; t = 17.2: 7, 2, 0, 5, 2, 2; t = 18.2: 8, 2, 0, 6, 0, 0, B12 shows 5 and C12 shows 6; t = 20.2: 8, 3, 0, 5, 1, 2; t = 21.2: 8, 3, 1, 6, 0, 0; t = 22.2: 9, 3, 1, 7, 0, 0 and F2 shows 184; t = 24.2: 9, 4, 1, 6, 1, 0; t = 25.2: 9, 5, 1, 5, 2, 2; t = 26.2: 9, 5, 2, 6, 1, 0 and soundTriggers 22, buzzes 6, recalcs 16, G7 shows 767; at t = 28.2 (after the cut-back): the sheet is the starting sheet (B2 shows 42, B12 shows "", G7 shows 752), selected "B2", editing false, undoDepth 0, redoDepth 0, errorCells 0, loops 1, edits 9, undos 5, redos 2, buzzes 6, soundTriggers 22, recalcs 16. Then a real click on the center of rect("C4") at t = 29.0 makes selected "C4" and stops the ghost; 7.9 s later (no input) selected is still "C4" and edits is still 9; 0.3 s after that selected is "B2" (cut back), and 2.0 s after that edits is 10 and B2 shows 48. The run has zero console errors.

Runs by model

No runs posted yet. Be the first: post yours and tag @wikiwayne.

Show the full prompt
POCKET SHEET: a Working Mini Spreadsheet with Formulas, Cell References, Cycle Errors and 50-Step Undo
HOOK OBJECT: window.__sheet

Build "POCKET SHEET": a small but real spreadsheet in plain HTML, CSS and JS (no libraries): a fixed grid of 8 columns (A to H) and 12 rows, cells that hold numbers, text or formulas, a formula bar, automatic recalculation in dependency order, defined error values for bad references, divisions by zero, bad syntax and circular references, and an undo/redo history 50 steps deep. It opens on a made-up weekly sales sheet for an imaginary kids' snack stand. It is fun to keep watching because a ghost user keeps editing the sheet, breaks it with a circular reference on purpose, and repairs it with undo.

LOOK
- Style: calm dark spreadsheet. Palette: page #0F1623, toolbar #141C2C, buttons #2A3A5C with text #E6EDF7, formula bar #172033, grid lines #243049, column and row headers #1A2438 with text #8FA3C7, cells #0F1623, summary rows 7 to 9 #162238, number text #E6EDF7 (right-aligned), text cells #B9C7E0 (left-aligned), error cells #3A1B22 with text #FF6B6B (centered), selected cell outline #FFB020 (2 px), status text #8FA3C7.
- Sizes (CSS px, 14 px monospace, about 8.4 px per character): toolbar 52 px high; formula bar 44 px high; grid = a 36 px column-header row, then 12 rows of 44 px, with a 40 px row-header column and 8 data columns of 88 px each, so the grid is 744 px wide and 564 px high; status line 36 px high. Cell padding is 6 px left and right, so a cell shows at most 9 characters (9 x 8.4 = 75.6 px of the 76 px inside) and longer text is simply clipped.
- Vertical order from the top: toolbar (title "POCKET SHEET", buttons UNDO and REDO, each 72 x 44 px, and the "🔊 TAP FOR SOUND" chip at the right end), formula bar (a 56 px name box showing the selected cell name such as "B2", then one text input, the editor, filling the rest), grid, status line. In portrait the chip sits on its own 36 px row below the status line. Grid top y = 96; the grid's left edge x = (width - 744) / 2 when the window is wider than 744 px, otherwise 0 and the grid area scrolls horizontally inside its own box while the page itself never scrolls sideways.
- Status line (14 px, at most 36 characters): "EDITS 0  UNDO 0  REDO 0  ERR 0" where UNDO and REDO are the current history depths and ERR is the current number of error cells.
- The starting sheet (raw text of each cell; every other cell is empty): row 1: A1 ITEM, B1 MON, C1 TUE, D1 WED, E1 THU, F1 FRI, G1 TOTAL, H1 AVG. Rows 2 to 6 (A = name, B to F = numbers): Lemonade 42 38 51 47 60; Cookies 25 31 28 35 40; Cocoa 12 9 15 11 8; Pretzel 18 22 20 26 30; Popcorn 33 29 36 41 45. In each of rows 2 to 6: G = SUM(B:F of that row), H = AVG(B:F of that row), written as =SUM(B2:F2) and =AVG(B2:F2) for row 2, and so on. Row 7: A7 TOTAL, B7 to F7 = SUM of rows 2 to 6 of that column (=SUM(B2:B6)), G7 =SUM(G2:G6), H7 =AVG(H2:H6). Row 8: A8 BEST, B8 to F8 and G8, H8 = MAX of rows 2 to 6 of that column (=MAX(B2:B6)). Row 9: A9 LOW, B9 to F9 and G9, H9 = MIN of rows 2 to 6 (=MIN(B2:B6)). Row 10: A10 PRICE, B10 2.5. Row 11: A11 SALES, B11 =G7*B10. Row 12 is empty.
- FIRST FRAME (t = 0, no input): the whole sheet visible with its computed values (for example G2 shows 238, H2 47.6, G7 752, H7 30.08, B11 1880), cell B2 selected with the outline, the name box "B2" and the editor showing 42, status "EDITS 0  UNDO 0  REDO 0  ERR 0". At 1280x720 the grid is 744 x 564 px at x 268 and y 96, which is 78% of the window height, and the status line ends at y 696. On a phone in portrait (390x844) the grid is still 744 x 564 px, 67% of the height, and scrolls sideways inside its box; this is expected.

MOTION / PLAY
- Cell content: the raw text typed (leading and trailing spaces removed, at most 36 characters; longer text is refused). Raw text starting with "=" is a formula. Raw text that matches ^-?(digits, optional .digits)$ is a number. An empty string is a blank cell. Anything else is text.
- Formula grammar: expression = term { (+ or -) term }; term = unary { (* or /) unary }; unary = "-" unary | primary; primary = number | cell | function "(" argument { "," argument } ")" | "(" expression ")". A number is digits with an optional .digits (no exponent). A cell is one letter A to H (any case) and a row 1 to 12; a token of letters followed by digits that is out of that grid (J1, A13, A0, AA1) is a cell token that evaluates to #REF!. Functions SUM, AVG, MIN, MAX in any case, with at least one argument. A range is cell ":" cell (either order, for example F2:B2) and is only allowed as a whole argument of a function. An argument that is exactly one cell or one range is a "range argument"; every other argument is an expression. Spaces between tokens are ignored. Anything that does not fit this grammar (an empty formula, a missing ")", a range outside a function, an unknown function, two numbers in a row, a stray character) gives #ERR!.
- Evaluation: a cell reference inside an expression gives the cell's number; a blank cell gives 0; a text cell gives #ERR!; an error cell gives its own error. A range argument contributes only the numeric cells of the range (text and blank cells are skipped); if one of them is an error cell, the first one in row-major order (row 1 first, left to right) is the result. SUM adds everything it was given (0 if nothing numeric). AVG is the sum divided by the count of numbers given (#DIV/0! if the count is 0). MIN and MAX give the smallest and largest number given (0 if none). Division by exactly 0 gives #DIV/0!. Operands are evaluated left to right and the first error ends the evaluation, so "=J1+1/0" is #REF! and "=1/0+J1" is #DIV/0!. The four error values are exactly "#REF!", "#DIV/0!", "#CYCLE!" and "#ERR!".
- Recalculation: after every commit, undo or redo, all 96 cells are recalculated, one by one in row-major order (A1, B1 ... H1, A2 ... H12), each with memory of its result. A cell that is reached again while it is still being calculated (directly or through other cells, including through a range that contains itself) gives #CYCLE! for that reference, and every cell that depends on it gets #CYCLE! too (errors travel through arithmetic and functions as above).
- Display: numbers are shown as String(Math.round(value * 100) / 100) (so 1/3 shows 0.33 and -0 shows 0), and if that text is longer than 9 characters, as value.toExponential(2) (1234567.891 shows 1.23e+6). Text shows as typed, blank shows nothing, errors show their error value.
- Editing and keys: a click or tap on a cell selects it. Arrow keys move the selection by one cell (stopping at the edges) when no edit is open. A printable single-character key (no Ctrl, Cmd or Alt) with no edit open selects the editor, replaces its text with that character and opens an edit (the cell keeps its old content until the edit is committed). Enter with no edit open opens an edit with the cell's raw text; Enter with an edit open commits the editor's text to the selected cell and moves the selection down one row (it stays on row 12). Tab with an edit open commits and moves the selection one column right (it stays on H). Escape cancels the open edit (the editor shows the cell's raw text again). Delete or Backspace with no edit open clears the selected cell. Any input event on the editor, or a tap on the editor, opens an edit. The page listens for keydown on the window (events sent to the window, the document or the focused element all reach it, and letters are compared in lower case). Real keyboard events that are only sent to the page do not type text, so the editor's own text is whatever its value is; the self-test sets the editor's value and dispatches an input event.
- Commit rule: committing text identical to the cell's current raw text changes nothing and records nothing. Otherwise it sets the cell, pushes {cell, before, after} on the undo list (50 entries at most; the oldest is dropped when a 51st arrives), empties the redo list, recalculates and counts an edit. Undo (Ctrl or Cmd + Z, or the UNDO button) pops the newest undo entry, restores "before", pushes it on the redo list and recalculates; Redo (Ctrl or Cmd + Shift + Z, Ctrl or Cmd + Y, or the REDO button) does the reverse; with nothing to undo or redo they do nothing. While an edit is open, Ctrl or Cmd + Z acts on the editor's text only.
- ATTRACT MODE: with no input, a hands-free ghost user runs from load, for 28.0 s in all: 2.0 s of calm up to the first commit at 2.0 s (the ghost starts typing at 1.5 s), then 24.0 s of script up to the last redo at 26.0 s, then 2.0 s of hold (2.0 + 24.0 + 2.0 = 28.0). The script uses the normal commit, undo and redo paths. Each edit at time e starts 0.5 s earlier: at e - 0.5 the ghost selects the cell and opens an edit whose editor already shows the new text; at e the edit is committed (the selection stays on that cell). Edits (time, cell, text): 2.0 B2 "48"; 4.0 D4 "=B4*2"; 6.0 B10 "3"; 8.0 B12 "=B12"; 10.0 C12 "=B12+1"; 12.0 D12 "=C12/0"; 14.0 E12 "=J1"; 18.0 B12 "5"; 22.0 F2 "=SUM(B2:E2)". Undo at 16.0, 17.0, 20.0, 24.0 and 25.0. Redo at 21.0 and 26.0. At 28.0 the sheet cuts back to the t = 0 state (the starting sheet, selection B2, no edit open, both history lists empty) with every cumulative counter (edits, undos, redos, recalcs, buzzes, soundTriggers) keeping its value and loops going up by 1, while the current-state values (undoDepth, redoDepth, errorCells, selected, editing) reset with the sheet. Any input (click, tap, key, wheel) takes over: the ghost stops where it is, and after 8 s with no input the sheet cuts back to the t = 0 state and the 28.0 s script restarts from time 0. Hook calls are not user input.
- Time: advance(seconds) runs round(60 * seconds) steps of 1/60 s. The 8 s idle timer counts the same 1/60 s steps as advance() (never wall-clock time).
- The hook also exposes: cell(ref) returning {raw, display, value, error} (ref like "B12" in any case; value is the number, or the text, or null when blank or an error; error is the error value or null), edit(ref, text) (the commit rule above on that cell: true if the sheet changed, false if refused or unchanged), undo() and redo() (true if they did something), select(ref), rect(ref) returning the cell's {x, y, w, h} in CSS px, layout() (grid is the 744 x 564 table itself, also on a phone where it sits inside the 390 px scroll box) returning {toolbar, formulaBar, grid, status, undoButton, redoButton, scrollWidth} as {x, y, w, h} in CSS px (scrollWidth = document.documentElement.scrollWidth), editor() returning the editor input element, attract(on) (false turns the ghost off), reset() (starting sheet, selection B2, empty history, every counter 0). setCameraOrbit(azimuthDeg, elevationDeg, scale) applies the CSS 3D transform perspective(1400px) rotateY(azimuth) rotateX(-elevation) scale(scale) to the whole page content, default (0, 0, 1).

SOUND
- A commit, undo or redo -> a tick (a commit: square 520 Hz, 0.05 s, gain 0.04; an undo: triangle gliding 440 Hz to 330 Hz, 0.1 s, gain 0.04; a redo: triangle gliding 330 Hz to 440 Hz, 0.1 s, gain 0.04).
- A recalculation that leaves more error cells than before it -> a buzz (square 110 Hz, 0.2 s, gain 0.04).
- With no AudioContext (before the first tap, and in ?test=1) nothing is played, but the triggers are still counted.

COUNTERS
stats() returns { fps, edits, undos, redos, recalcs, undoDepth, redoDepth, errorCells, buzzes, loops, soundTriggers, selected, editing }.
- edits: +1 for each commit that changed a cell (never for a refused or unchanged commit). undos: +1 for each undo that did something. redos: +1 for each redo that did something. recalcs: +1 for each recalculation, which is exactly one per edit, undo and redo (the first calculation at load and the cut-back reset do not count).
- undoDepth and redoDepth: the current length of each history list. errorCells: the number of cells that show an error right now. buzzes: +1 each time a recalculation leaves more error cells than before it. loops: +1 at every cut-back.
- soundTriggers: +1 for every tick and every buzz, whether or not sound is on; so it always equals edits + undos + redos + buzzes.
- selected: the selected cell name ("B2"). editing: true while an edit is open.
- On screen: the status line above (edits, depths, errors) and the name box, readable in a paused frame and never over the grid.

CHECKS for ?test=1
With ?test=1, run an accelerated self-test that measures real cells, real layout and real events (not self-set flags) and logs "TEST n PASS" or "TEST n FAIL: reason" to the console and to window.__testResults:
Each check starts from a fresh load; advance() steps in 1/60 s increments.
1. After attract(false) at t = 0: stats() has edits, undos, redos, recalcs, undoDepth, redoDepth, errorCells, buzzes, loops and soundTriggers all 0, selected "B2" and editing false; the editor's value is "42"; cell(ref).display is "Lemonade" for A2, "42" for B2, "238" for G2, "47.6" for H2, "11" for H4, "130" for B7, "183" for F7, "752" for G7, "30.08" for H7 (cell("H7").value within 1e-9 of 30.08), "42" for B8, "238" for G8, "12" for B9, "8" for F9, "55" for G9, "2.5" for B10, "1880" for B11 and "" for A12 (value null); cell("B7").raw is "=SUM(B2:B6)"; at 1280x720 layout() has toolbar h 52, formulaBar y 52 and h 44, grid x 268, y 96, w 744 and h 564 and status y 660 (each within 2), rect("B2") is x 396, y 176, w 88, h 44 (each within 2), and the grid height is at least 0.75 of 720; at 390x844 layout().grid is x 0, y 96, w 744, h 564 (each within 2), its height is between 0.64 and 0.70 of 844, rect("B2") is x 128, y 176, w 88, h 44 (each within 2) and layout().scrollWidth is at most 390; the undo and redo buttons are each at least 44 x 44.
2. After attract(false), commit each text below in turn into B12 with edit("B12", text) and compare cell("B12").display (the value is the number, or the text, or null; error is null except for errors); the texts are quoted and separated by semicolons. Numbers and text: "42" gives 42; "-3.5" gives -3.5; "hello" gives hello (text). Formulas: "=1+2*3" gives 7; "=(1+2)*3" gives 9; "=10-4-3" gives 3; "=100/4/5" gives 5; "=-2*-3" gives 6; "=2*-(1+2)" gives -6; "=B2+C2" gives 80; "=b2*c2" gives 1596; "=SUM(B2:F2)" gives 238; "=sum(b2:f2)/5" gives 47.6; "=AVG(B2:C3)" gives 34; "=MIN(B2:F6)" gives 8; "=MAX(B2:F6)" gives 60; "=SUM(B2:B6, 100, C2*2)" gives 306; "=SUM(F2:B2)" gives 238; "=SUM(A2:A6)" gives 0; "=MAX(A2:A6)" gives 0; "=SUM(B2)" gives 42; "=SUM(A2)" gives 0; "=MAX(B2:B6)-MIN(B2:B6)" gives 30; "=SUM(1,MAX(B2:B3))" gives 43; "=B10*B2" gives 105; "=B2/B4*3" gives 10.5; "=0-0" gives 0; "=-0*5" gives 0; "=12345678" gives 12345678; "=1/3" gives 0.33; "=2/3" gives 0.67; "=0.1+0.2" gives 0.3; "=1234567.891" gives 1.23e+6 (its value within 1e-6 of 1234567.891). Errors (display and error both equal the error value): "=AVG(A2:A6)", "=1/0", "=SUM(B2:F2)/0" and "=1/0+J1" give #DIV/0!; "=B13", "=J1", "=A0", "=SUM(A1:J3)" and "=J1+1/0" give #REF!; "=A2+1", "=1+", "=SUM()", "=SUM(B2:C3", "=B2:C3", "=FOO(1)", "=2 3" and "=" give #ERR!. Also edit("B12", "= 1 + 2 ") returns true and leaves cell("B12").raw as "= 1 + 2" with display 3, and edit("B12", "= 1 + 2") then returns false; a text of 37 characters is refused (edit returns false, raw unchanged) while one of exactly 36 characters is accepted.
3. After attract(false): edit("B2", "50") makes G2 246, H2 49.2, B7 138, G7 760, H7 30.4, B8 50, G8 246, H8 49.2 and B11 1900. Then edit B12 "=C12+1", C12 "=D12+1", D12 "=B7" gives B12 140, C12 139, D12 138; edit("B3", "30") makes B7 143, D12 143, C12 144, B12 145, G3 164 and H3 32.8 (each cell shows these displays right after the edit, with no extra frame or event). Then edit C12 "=B12+1" makes B12 and C12 "#CYCLE!" (errorCells 2, D12 still 143); edit D12 "=B12*2" and E12 "=SUM(B12:D12)" make D12 and E12 "#CYCLE!" (errorCells 4); edit F12 "=B7+1" shows 144; edit C12 "7" repairs everything: B12 8, C12 7, D12 16, E12 31, errorCells 0. Then edit A12 "=SUM(A1:A12)" shows #CYCLE! (errorCells 1) and edit A12 "=SUM(A1:A11)" shows 0 (errorCells 0). Then a real click (pointerdown, pointerup) at the center of rect("B2") makes stats().selected "B2" and a real keydown "Delete" clears it: cell("B2").raw is "", display "", G2 196, H2 49, B7 93 and B11 1787.5. Then edit G12 "=B2+1" shows 1 and edit H12 "=AVG(B2:B2)" shows #DIV/0!. At the end stats() has edits 15, recalcs 15, undos 0, redos 0, undoDepth 15, redoDepth 0, errorCells 1, buzzes 5 and soundTriggers 20.
4. After attract(false): undo() and redo() both return false. Real click at the center of rect("C3") gives selected "C3"; real keydowns ArrowDown, ArrowRight, ArrowUp, ArrowLeft give "C4", "D4", "D3", "C3"; five more ArrowUp give "C1" and five ArrowLeft give "A1" (the edges stop it). Then for each of B12 "1", C12 "2", D12 "3": a real click at the center of that cell's rect(), a real keydown of the single character, then a real keydown "Enter" (the editor's value is that character right after the first keydown and stats().editing is true; the cell's raw is still "" until Enter; after Enter editing is false and the cell holds the text); stats().edits is 3, undoDepth 3. A real click on A12, keydown "9" then keydown "Escape": editing false, the editor shows "", A12 raw "", edits 3; keydown "Delete" on that empty cell changes nothing (edits 3); edit("D12", "3") returns false. A keydown "z" with metaKey true empties D12 (undos 1, undoDepth 2, redoDepth 1, recalcs 4); a keydown "Z" with ctrlKey and shiftKey restores D12 "3" (redos 1, redoDepth 0, recalcs 5); two keydowns "z" with ctrlKey empty D12 and C12 (undos 3, undoDepth 1, redoDepth 2, recalcs 7); a keydown "y" with ctrlKey restores C12 "2" (redos 2, redoDepth 1, recalcs 8); a real click on A12 then keydown "4" and "Enter" commits A12 "4" (edits 4, redoDepth 0, undoDepth 3, recalcs 9); a real click on the UNDO button (center of layout().undoButton) empties A12 (undos 4, recalcs 10) and one on the REDO button restores it (redos 3, recalcs 11, undoDepth 3). Then edit("A12", String(i)) for i = 1 to 60: undoDepth is 50 and edits 64 (the first 10 of these were pushed off the list). Then call undo() 60 times: exactly the first 50 return true, A12's raw is "10", undoDepth 0, redoDepth 50, undos 54; then redo() 60 times: exactly the first 50 return true, A12's raw is "60", undoDepth 50, redoDepth 0, redos 53; B12, C12 and D12 hold "1", "2" and "" through the last three steps; at the end recalcs is 171.
5. Fresh load with the demo running, advance() frame by frame to each time (frames = 60 x t) and read stats() and cells (the six numbers are edits, undos, redos, undoDepth, redoDepth, errorCells): t = 2.2: 1, 0, 0, 1, 0, 0 and B2 shows 48; t = 3.75: selected "D4", editing true, the editor's value "=B4*2", cell D4 raw still "15", edits 1; t = 4.2: 2, 0, 0, 2, 0, 0, editing false and D4 shows 24; t = 6.2: 3, 0, 0, 3, 0, 0, B11 shows 2301; t = 8.2: 4, 0, 0, 4, 0, 1, B12 shows #CYCLE!; t = 10.2: 5, 0, 0, 5, 0, 2; t = 12.2: 6, 0, 0, 6, 0, 3 and D12 shows #CYCLE!; t = 14.2: 7, 0, 0, 7, 0, 4 and E12 shows #REF!; t = 16.2: 7, 1, 0, 6, 1, 3; t = 17.2: 7, 2, 0, 5, 2, 2; t = 18.2: 8, 2, 0, 6, 0, 0, B12 shows 5 and C12 shows 6; t = 20.2: 8, 3, 0, 5, 1, 2; t = 21.2: 8, 3, 1, 6, 0, 0; t = 22.2: 9, 3, 1, 7, 0, 0 and F2 shows 184; t = 24.2: 9, 4, 1, 6, 1, 0; t = 25.2: 9, 5, 1, 5, 2, 2; t = 26.2: 9, 5, 2, 6, 1, 0 and soundTriggers 22, buzzes 6, recalcs 16, G7 shows 767; at t = 28.2 (after the cut-back): the sheet is the starting sheet (B2 shows 42, B12 shows "", G7 shows 752), selected "B2", editing false, undoDepth 0, redoDepth 0, errorCells 0, loops 1, edits 9, undos 5, redos 2, buzzes 6, soundTriggers 22, recalcs 16. Then a real click on the center of rect("C4") at t = 29.0 makes selected "C4" and stops the ghost; 7.9 s later (no input) selected is still "C4" and edits is still 9; 0.3 s after that selected is "B2" (cut back), and 2.0 s after that edits is 10 and B2 shows 48. The run has zero console errors.

KEEP IT SHORT
- Keep the whole file under about 1,500 lines (soft target) so you can write it in one pass and finish well inside 15 minutes.
- Save lines with helpers, loops and instancing, not by dropping features. Everything above must really work: no placeholders, no TODOs.

BUILD RULES (all required):
- Deliver ONE self-contained HTML file: inline CSS and JS, no build step, no local assets. Libraries only from a CDN. If you use Three.js, use exactly this import map: {"imports":{"three":"https://cdn.jsdelivr.net/npm/three@0.160.0/build/three.module.js","three/addons/":"https://cdn.jsdelivr.net/npm/three@0.160.0/examples/jsm/"}}
- It must open straight from disk in desktop Chrome and on an iPhone (Safari), fill the full screen, handle resize and touch, and stay smooth (target 60 fps).
- It must look stunning in the very FIRST frame: no black screen, no loading wait, no tiny subject. The main subject fills at least 50% of the screen height.
- SOUND (required): all sound is made in code with Web Audio (no audio files). Show a small "🔊 TAP FOR SOUND" chip; on the first tap create ONE AudioContext, route everything through a master gain of 0.6 into a DynamicsCompressor, and hide the chip. Also expose enableAudio() on the hook object named at the top.
- Expose the hook object named at the top with: setCameraOrbit(azimuthDeg, elevationDeg, distance) (or an equivalent camera setter), advance(seconds) that steps the simulation exactly that much for still captures, enableAudio(), and stats() returning {fps, ...the counters named above}. Use a fixed random seed of 360 so every run is the same.
- Every on-screen counter must count a real event you can see happen. No fake numbers.
- No text overlapping the subject; any label must be readable in a paused frame.
- No brand logos, no real people, no copyrighted characters, brand names or logos.

FAILURE MODES TO AVOID
- Using eval, new Function or a spreadsheet library instead of a real tokenizer, parser and evaluator for the stated grammar.
- Wrong operator rules: 10-4-3 not left to right, unary minus that breaks, a range allowed outside a function, or lower-case cell and function names that fail.
- Wrong function rules: text or blank cells counted as numbers in a range, AVG dividing by the number of cells instead of the count of numbers, MIN or MAX of nothing giving an error, or a reversed range like F2:B2 failing.
- Errors that are not exactly #REF!, #DIV/0!, #CYCLE! and #ERR!, errors that do not travel to dependent cells, the wrong first error in "=J1+1/0" and "=1/0+J1", or a circular reference that hangs the page or crashes it.
- A sheet that does not recalculate after every commit, undo and redo, or recalculates only the edited cell instead of all 96.
- A history that records no-op edits, never clears the redo list on a new edit, is not capped at 50, or whose undo does not restore the exact old raw text.
- Keys that need a mouse click first, Enter that does not move down, Escape that still commits, or Ctrl or Cmd plus Z that fights the editor while an edit is open.
- Counters that miss an edit, undo or redo, buzzes that are not tied to a recalculation that really added error cells, or soundTriggers that do not equal edits + undos + redos + buzzes.
- Numbers shown with long floating-point tails (0.30000000000000004), cell text spilling out of its 88 px cell, or a grid that scrolls the whole page sideways on a phone.
- A black or empty first frame, text over the grid, tap targets smaller than 44 px, or a cut-back that leaves the old edits or history behind.
- The same variable declared twice, or methods called on objects that don't exist yet.

SELF-TEST LOOP
- If you can run code: build the file, open it, read the console, run ?test=1, and take screenshots at 3 s, 10 s and 30 s at 1280x720 and 390x844. Look at the screenshots and fix what looks wrong. Fix and retest until all 5 checks pass with zero console errors. Mark anything you could not run as UNMEASURED; never invent results.
- If you are chat-only: go through this prompt line by line, check your code against each line, and fix anything that would fail. Then write one corrected, complete file.
- Final answer: ONE complete HTML file in ONE code block, then the 5 checks marked PASS, FAIL or UNMEASURED. No snippets, no "rest unchanged".

Built one? Post it on X and tag @wikiwaynePost on X

More Very Hard prompts

Wizard's Chess

Very HardGames
PL-0834 runs

Endless Neighborhood Day

Very HardCities & buildings
PL-0764 runs
Ant Empire

Ant Empire

Very HardCreatures & characters
PL-194No runs yet

More Page layouts & UI prompts

Glass Weather

EasyPage layouts & UI
PL-0634 runs

Synth Cockpit

HardPage layouts & UI
PL-0694 runs
Vinyl Deck

Vinyl Deck

MediumPage layouts & UI
PL-182No runs yet