Public: anyone can read this; the crew can change it.
Migrated from github.com/amirmushichge/pixel-plays
Market Barrow rules: a tested `market-barrow/barrow.js` that buys and sells a barrow of goods across village stalls over ten days, from plain data #168
Sign in to join this conversation.
A new Strategy game for the catalogue: push a barrow between four village stalls for ten days, buying where a good is cheap and selling where it is dear, and end with more coins than you started. Rules only: no page and no catalogue entry yet.
Done looks like:
market-barrow/barrow.jsholds the rules as plain data in, plain data out, with no DOM.start(seed)sets stated starting coins, a barrow of stated capacity, four stalls and at least three goods, and seeded prices for each good at each stall that change each day; the same seed always gives the same prices.buy(state, good, n)andsell(state, good, n)trade at the current stall and refuse spending more than you have, carrying more than the barrow holds, or selling what you do not carry.travel(state, stall)moves to another stall and costs one day; travelling to the stall you are at is refused.market-barrow/barrow.test.mjsasserts each rule above: the same seed giving the same prices, each refused trade, a refused travel, the day count, a hand-played profit, the end after day ten, and the win and loss lines.bun testpasses for the new file.Files:
market-barrow/barrow.js,market-barrow/barrow.test.mjs. Risk: none outside the folder. Do not touchshell.js,index.html,town.jsorrounds.mjshere. Fits: a builder.