Visualizations
482 / 500

482 · Simulation

Water Economy

A glass-and-brass hydraulic computer where water is money and valves are policy.

In the spirit of Bill Phillips' 1949 hydraulic computer, money is water: spending in the bottom tank is pumped up as national income, then split by pipes into taxes for the Treasury, imports that drain abroad, savings that collect as idle balances, and consumption that falls straight back. Government spending, investment and exports pour back in. Underneath is a coupled stock-and-flow model integrated every frame, with float valves for the behaviour: the fuller the idle balances, the lower the interest rate read off its float, which sets investment along the curve on the little I(r) slide, and an accelerator makes investment chase growth so shocks overshoot before settling. A pen plotter records income and the interest rate and pencils in every policy change.

Try it. Drag a red handwheel up or down to set the tax rate, government spending, exports or the bank rate, and watch the new level slosh through the pipes with the multiplier. Click any tank to pour in a bucket of money. Pick a valve with 1 to 4 or the left and right arrows, turn it with up and down, or press R to reset. Left alone, it runs a tour of export booms, tax rises and rate cuts.

  • Stock-and-flow simulation
  • Keynesian multiplier and accelerator
  • Animated pipes with dash offsets

View the source · one module, plus a small shared runtime for sizing, the animation loop and input

Build your own

Paste this into Claude Code, Codex or any coding agent to get a simple version running, then take it wherever you like.

Build a hydraulic economy simulator, like Bill Phillips' 1949 water computer, with JavaScript and the HTML canvas element. Put everything in a single index.html file with no libraries or build step, so I can open it directly in a browser.

Start simple:
- Make a full-window canvas, sharp on high-DPI screens (scale by devicePixelRatio), painted a warm cream.
- Model money as water in two tanks: a spending sump E at the bottom and an income tank H at the top. Each frame, pump P = 0.9 E up into H and let income Y = 0.9 H flow out of it.
- Split income with fixed fractions: taxes T = 0.2 Y, imports 0.15 of what is left, savings 0.12 of what is left, and the rest is consumption. Consumption, a constant government spending of 20 and constant exports of 15 flow back into the sump. Integrate the stocks with small Euler steps.
- Draw each tank as a glass rectangle with its water level, and each flow as a thick pipe whose inner water line gets thicker with the flow. Animate a dashed highlight along each pipe with lineDashOffset so you can see the water move.

Once that works, make it a machine:
- Add a Treasury tank that taxes fill and government spending drains, and an idle balances tank that savings fill and investment drains. Make the interest rate fall as idle balances rise and investment fall as the interest rate rises.
- Add sliders or draggable valves for the tax rate, exports and government spending, and a scrolling paper chart that plots income over time, so I can see the multiplier when I open the export tap.

Explain the key ideas in short code comments. When you're done, tell me how to open it and suggest three directions I could take it next, such as an accelerator term that makes investment chase growth and creates business cycles, water falling from pipe ends into the tanks with bubbles and sloshing surfaces, or a second linked economy that trades through the import and export pipes.
PreviousSyntax RailroadA recursive descent parser drives a train through railroad syntax diagrams. NextWandering DunesCrescent dunes march across a desert, built by a three-rule sand slab model.

Related visualizations

  • Flood DioramaFluids A dam fails above a miniature town and a muddy flood spreads through the valley.
  • Max Flow WaterworksAlgorithms Water fills a hand-drawn pipe network until the minimum cut lights up in red.
  • SPH WaterFluids Thousands of particles that slosh, splash and pour like a liquid.
  • WatercolorGenerative art Pigment rides a shallow-water layer, pools at the edges and granulates on paper.
  • Water RipplesFluids Raindrops on a koi pond, with ripples that bend the scene below.
  • Crowd Flow FieldsSimulation Two armies of 3,600 units pour across a river map, steered by one Dijkstra each.
  • Marble ComputerPhysics A wooden pegboard computer where falling marbles count, add and multiply in binary.
  • Glass HarpSound Ray-traced wine glasses, tuned with water and sung by stick-slip friction on the rim.
  • Congestion ControlSimulation TCP flows share one bottleneck as cars on a night on-ramp. Watch the sawtooth emerge.

Use ← and → to move between demos. While the canvas has focus, keys go to the demo instead.

← More from Emergent Mind Labs