# The simulator

    dbsim PROJECTFOLDER [-players N] [-days N] [-seed N] [-csv FILE] [-json] [-v]

It compiles a copy of the game and plays it through the engine itself, in a temporary
folder. The same seed gives the same report. `-v` shows what everybody does. It ends with
an error when a target fails or something in the game went wrong.

`sim.json`:

| | |
|---|---|
| `players` `days` `visits` | how many, and the most choices a player takes in a day |
| `track` | values to follow: a name, and script about `player` |
| `strategies` | `name`, `share`, and either or both of `weights` (`"place.KEY": 2`; 1 if not given) and functions |
| `targets` | `track`, `who` (a strategy), `day`, `stat` (low, median, average, high), `min`, `max` |

The functions are in `scripts/sim_*.dbs`, which are left out of a `-release` game. They may
look but not change anything:

| | |
|---|---|
| `choose(place: text): text` | the key to press, `""` to leave it to the weights, `"-"` to stop for the day |
| `answer(prompt: text, low, high): number` | a number; a list is 0 (none) to the number of entries, yes/no is 1 or 0, a key its place among those allowed. Out of range leaves it to chance |
| `text(prompt: text): text` | |

It reports the tracked values by strategy, choices never taken, functions never run, faults,
and numbers or texts that reached a limit, with where.
