← Back to Projects

Haggle
LiveMost idle games are numbers that go up. In Haggle the numbers are prices, and they push back. Make grain, sell too much of it, and watch your own price fall; hold off and it climbs back. A shortage lifts ore, a rival dumps wool, a fad takes cloth. Hire factors, buy a contract, corner a scarce good, then close the app and come back to a report of what the market did without you. It works with a thumb or a mouse, offline, with nothing to sign up for.
Screenshots
What It Does
- →Gives you ten goods in a chain, from grain, timber, wool and ore up through flour, cloth and iron to bread, coats and tools, each made by its own producer
- →Moves every price with supply and demand: sell a lot at once and your own price falls along the curve, stop and it recovers, with a quote under each button before you commit
- →Surprises you every few minutes with a shortage, a strong harvest, a rival dumping stock, a fad or a slump, written up in a quiet market report
- →Lets you automate: factors that sell above a floor price you set, a clerk that buys missing inputs while they are cheap, then trade routes, contracts and monopolies
- →Keeps the market moving while you are away, up to 24 hours, and greets you with one report: time away, what sold, the price moves that mattered and a one-line verdict
- →Lets you retire the house for standing and start again faster, saves on your device, exports a text code, installs, and works with the network cut
What I Built
- →A market model of stock, target price, easing and elasticity per good, with a closed-form limit order and a price curve that gives the same result whether you sell in one lump or in a thousand taps
- →Weather and events that are pure functions of seed, good and time, so the same seed replays the same market and an offline catch-up sees exactly the events a live loop would have
- →One step function for the live loop (0.25 s on the real clock, with catch-up) and for time away (2 s steps in slices that keep the page alive), tested to agree within 1% over eight hours
- →Saves in the browser that are schema-validated and versioned on every read, a corrupt one set aside with a clear message, and a checksummed export code that is size-capped, decoded strictly and never evaluated
- →A phone-first React and canvas client with a real desktop layout, tabular figures, hold-to-repeat, a held-to-confirm retire flow and motion that respects reduced-motion settings
- →118 tests including a hostile-save suite, a headless-Chrome privacy and offline walk, an axe-core run over every screen, a strict content security policy with no remote origin, and a greedy bot that plays the economy to check the pacing


