Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Ruddle/EconomySimulator
https://github.com/Ruddle/EconomySimulator
Last synced: about 6 hours ago
JSON representation
- Host: GitHub
- URL: https://github.com/Ruddle/EconomySimulator
- Owner: Ruddle
- License: mit
- Created: 2023-09-19T10:18:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-09-19T10:32:00.000Z (about 1 year ago)
- Last Synced: 2023-09-19T13:08:33.490Z (about 1 year ago)
- Language: JavaScript
- Size: 10.7 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-technostructure - Ruddle/EconomySimulator
- awesome-technostructure - Ruddle/EconomySimulator
README
# EconomySimulator
Code of the simulator, and its display, from the blog post [Building an economy simulator from scratch](https://thomassimon.dev/ps/4).
It uses mithril.js.# How to use
Example of usage:
Simulation 25 from the blog post```js
import m from "mithril";
import * as economy from "./economy.js";economy.init(m);
let options = {
money: true,
overconsume: true,
bidding: true,
sellMin: true,
qol2: true,
highNumbers: true,
truncate: true,
resourcesCons: ["food", "water", "wood"],
peopleOpt: [
{ producer: "food", money: 1000 },
{ producer: "food", money: 1000 },
{ producer: "food", money: 1000 },
{ producer: "wood", money: 1000 },
{ producer: "water", money: 1000 },
{ producer: "gov", money: 1000 },
{ producer: "gov", money: 1000 },
{ producer: "gov", money: 1000 },
],
prices: { food: 100, wood: 100, water: 100 },
gov: {
resources: { money: 1000 },
tax: 3,
autoTax: false,
print: true,
fluid: { mul: 1.5 },
},
};m.mount(document.body, { view: () => m(economy.Root, options) });
```