OBSERVANDUM.PRG

2024-05-19 → 2024-09-14 · 31 commits · solo · PUBLIC

WHAT IT IS.

The head commit is titled "(sort of) working," which is an accurate self-review for a project whose entire point was making equilibrium something you watch happen instead of something you just derive. "Economics from bottom up": a browser model where indifference contours, exchange events, and equilibrium prices are drawn from primitives you can inspect. Three build files plus observandum.code-workspace; two runnable HTML surfaces (src/index.html, src/exchange.html); three source modules (src/index.js, src/exchange.js, src/util/contour.js); one agent (src/agents/individual.js); one artifact (src/artifacts/utility.js); one scratch file (scratchpad.txt); and two Jest tests. Build pipeline: esbuild for bundling/serving, marchingsquares for contour extraction, live-server for hot reload; phaser and lodash are available but lightly used — the maths is hand-rolled (no plotting library in the renderer). The capstone commit Inspectable COBB-DOUGLAS, bump exchange (2024-09-14) is the whole thesis in two clauses: a utility function you can read, an exchange mechanism you can replay.

THE ARC.

Initial commit (2024-05-19 09:22) is eleven files in one go: the esbuild scripts, the workspace, the package, the assets, the first generateContourData.js. One hour later, With tests adds Babel + Jest, the first two test files, plus individual.js and utility.js. The opening week is a march: Contour is drawing, both curves (up and down) plotted (the day-old generateContourData.js is deleted, replaced by src/util/contour.js +101), Number of contours (just a knob), contour without ploty.js (renderer rewritten without Plotly), Contour using marchingsquares (algorithm swap — marchingsquares npm replaces the hand-rolled grid traversal). The equilibrium lines, the exchange event, and the first price label follow.

Then the discipline week: added prices, shading, then four Refactoring commits in 24 hours (3e9980c alone is index.js −129 and contour.js −127), then Takes full windows, readjusts, auto trigger, plotting end position, color scheme, longer tradings (scratchpad.txt checked in), added controls, and Plotting prices at finished trades. Summer dormancy. September rebuild: Moved to inner container (canvas inside a container), then a triple — Split panel, Page laid out, added new page (the second surface, exchange.{html,js}). Basic elements implemented, Balls okay now (the agent body got its physics — 209 lines added to individual.js), and the capstone Inspectable COBB-DOUGLAS, bump exchange (exchange.js +340/−180). The head commit is (sort of) working — the WIP tag left in deliberately.

The architecture: src/util/contour.js calls marchingsquares.isoLines over a sampled utility grid and emits polygon segments; src/agents/individual.js holds the agent state (position, holdings, utility parameters, exchange FSM); src/artifacts/utility.js defines the Cobb-Douglas form. src/index.js is the contour-and-trade surface (one agent); src/exchange.js is the two-agent page (balls, bump-exchanges). Jest covers only individual and utility.

Stack chips: Vanilla JS · esbuild · live-server · marchingsquares · phaser (available, lightly used) · lodash · Jest · Babel · ESLint flat config · Prettier · Cobb-Douglas utility.

WHAT I LEARNED.

  • Hand-rolling the renderer forces you to understand the math: shading without a plotting library, price labels only on completed trades, contours as polygon segments.

  • Five "Refactoring" commits in a day is the right cadence for a single-file prototype — index.js lost 200 lines in 24 hours and became the surface the September rebuild could actually extend.

  • "Inspectable" is the whole brief: the capstone puts the Cobb-Douglas parameters and the exchange bump on stage, in the source. Same move gave the agents bodies in the Balls okay now rewrite — math into geometry you can click on.

[ DEODORO ] > CODE / observandum EJECT → SHELF