A generic JavaScript * wars engine. Inspired by Drugwars.
Assuming Node.js and npm are installed, clone this repo and run from the command line:
cd x-wars
npm install
Runs all tests.
Lints and builds the JavaScript into a distributable file in dist
.
Runs tests in watch mode in response to changes to any JavaScript file in the src
or test
directories.
Lints the JavaScript code in src
and test
directories.
Builds the module into a single file in dist
.
On a UNIX-like system (including Mac), run this once:
chmod u+x demo/index.js
Then to play the demo:
demo/index.js
- time (30 days, 1 day per move)
- six locations
- six items to buy/sell
- space for items (100) (randomly offered)
- starter money/loan ($2000)
- weapons (0 at start) (randomly offered)
- loan sharks
- vs cops: get arrested, run, fight
- $ award for killing cop
- random: muggin, increased drug prices, finding of drugs
- final score: current amount cash * 2, then number of millions out of 100. So $25,000,000 = 50/100.
- X reset
- X go (location; time decrements)
- X buy (item)
- X sell (item)
- X pay (back loan shark)
- X borrow (from loan shark)
- X finish (time out)
- buy (weapon, storage)
- surrender/flee/fight (cops, muggers)
- deposit (to bank)
- withdrawal (from bank)
- data (private) / or just use WeakMap
I = P * r * t
Interest earned = Princial * rate * time