landlord-ts 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +111 -0
- package/data/all_cards.json.gz +0 -0
- package/dist/chunk-I6ETCO5F.js +803 -0
- package/dist/index.cjs +2487 -0
- package/dist/index.d.cts +504 -0
- package/dist/index.d.ts +504 -0
- package/dist/index.js +1681 -0
- package/dist/simulation-worker.cjs +208 -0
- package/dist/simulation-worker.d.cts +2 -0
- package/dist/simulation-worker.d.ts +2 -0
- package/dist/simulation-worker.js +33 -0
- package/package.json +102 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Lacy Garrison
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
# landlord-ts
|
|
2
|
+
|
|
3
|
+
Pure TypeScript Monte Carlo simulator for Magic: The Gathering on-curve probabilities. Port of the Rust [landlord](https://github.com/mtgoncurve/landlord) engine used by [mtgoncurve.com](https://mtgoncurve.com).
|
|
4
|
+
|
|
5
|
+
## Requirements
|
|
6
|
+
|
|
7
|
+
- Node.js **24** recommended (see `.nvmrc`); `engines.node` is `>=22`
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install landlord-ts
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Usage
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { run } from 'landlord-ts';
|
|
19
|
+
|
|
20
|
+
const runs = 10_000;
|
|
21
|
+
|
|
22
|
+
const input = {
|
|
23
|
+
code: `
|
|
24
|
+
1 Llanowar Elves
|
|
25
|
+
1 Forest
|
|
26
|
+
`,
|
|
27
|
+
runs,
|
|
28
|
+
onThePlay: true,
|
|
29
|
+
mulliganDownTo: 5,
|
|
30
|
+
mulliganOnLands: [0, 1, 6, 7],
|
|
31
|
+
acceptableHandList: [],
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
const output = run(input);
|
|
35
|
+
|
|
36
|
+
console.log({
|
|
37
|
+
deckSize: output.deckSize,
|
|
38
|
+
deckAverageCmc: output.deckAverageCmc,
|
|
39
|
+
totalSimulations: output.totalSimulations,
|
|
40
|
+
// Often < 7: London mulligans put cards on the bottom
|
|
41
|
+
avgOpeningHandSize: output.avgOpeningHandSize,
|
|
42
|
+
avgOpeningLandCount: output.avgOpeningLandCount,
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
for (const row of output.cards) {
|
|
46
|
+
console.log({
|
|
47
|
+
name: row.name,
|
|
48
|
+
manaCost: row.manaCost,
|
|
49
|
+
copies: row.copies,
|
|
50
|
+
playedOnCurve: row.playedOnCurve,
|
|
51
|
+
notPlayedOnCurve: row.notPlayedOnCurve,
|
|
52
|
+
totalSimulations: row.totalSimulations,
|
|
53
|
+
pCastOnCurve: row.pCastOnCurve,
|
|
54
|
+
pManaGivenCmc: row.pManaGivenCmc,
|
|
55
|
+
notEnoughLands: row.notEnoughLands,
|
|
56
|
+
colorOrTimingFail: row.colorOrTimingFail,
|
|
57
|
+
manaOkUndrawn: row.manaOkUndrawn,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
for (const land of output.landCounts) {
|
|
62
|
+
console.log({
|
|
63
|
+
name: land.name,
|
|
64
|
+
kind: land.kind,
|
|
65
|
+
copies: land.copies,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
`RunInput` / `RunOutput` use camelCase field names. `RunOutput` is a single flattened on-curve report (`cards`, ranked insights, land tallies).
|
|
71
|
+
|
|
72
|
+
Validate a textarea decklist before simulating with **`parseDecklist(code)`** (non-throwing Result; unknown cards set `error.unknownCardNames`).
|
|
73
|
+
|
|
74
|
+
For the full `RunInput` / `RunOutput` contract, `runAsync` (progress callbacks), and Next.js SSE streaming, see the wiki:
|
|
75
|
+
|
|
76
|
+
- [landlord-ts API](https://github.com/lggarrison/landlord-ts/blob/develop/wiki/concepts/landlord-ts-api.md)
|
|
77
|
+
- [Streaming progress](https://github.com/lggarrison/landlord-ts/blob/develop/wiki/concepts/streaming-progress.md)
|
|
78
|
+
|
|
79
|
+
## Development
|
|
80
|
+
|
|
81
|
+
```bash
|
|
82
|
+
npm install
|
|
83
|
+
npm run card-update # fetch Scryfall bulk data → data/all_cards.json.gz
|
|
84
|
+
npm test
|
|
85
|
+
npm run build
|
|
86
|
+
npm run release:check
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
See [CONTRIBUTING.md](./CONTRIBUTING.md) for the branch model, hooks, and PR checklist. Maintainers: [RELEASING.md](./RELEASING.md).
|
|
90
|
+
|
|
91
|
+
### Branching
|
|
92
|
+
|
|
93
|
+
- **`develop`** — integration branch; open feature PRs here
|
|
94
|
+
- **`main`** — releases only (`develop` → `main`)
|
|
95
|
+
|
|
96
|
+
### Wiki
|
|
97
|
+
|
|
98
|
+
This repo uses [llm-wiki-manager](https://github.com/lggarrison/llm-wiki-manager). See [`AGENTS.md`](./AGENTS.md) and [`wiki/AGENTS.md`](./wiki/AGENTS.md).
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
npm run wiki:help
|
|
102
|
+
npm run wiki:lint
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
## Card data
|
|
106
|
+
|
|
107
|
+
Shipped card data in `data/all_cards.json.gz` is derived from [Scryfall](https://scryfall.com/docs/api) bulk oracle data. This project is not affiliated with Scryfall. Regenerate with `npm run card-update`.
|
|
108
|
+
|
|
109
|
+
## License
|
|
110
|
+
|
|
111
|
+
[MIT](./LICENSE) — see also [SECURITY.md](./SECURITY.md) and [CODE_OF_CONDUCT.md](./CODE_OF_CONDUCT.md).
|
|
Binary file
|