@tungstenstudio/outschart-generator 1.0.0-rc.0 → 1.0.0-rc.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/README.md +2 -13
- package/dist/index.cjs +1 -31
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -3
- package/dist/index.d.ts +1 -3
- package/dist/index.js +1 -30
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +0 -1
- package/src/recommend.ts +1 -1
- package/src/filter.ts +0 -35
package/README.md
CHANGED
|
@@ -2,12 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
Darts outs/checkout chart generator with pre-computed lookups and a miss-aware recommendation engine.
|
|
4
4
|
|
|
5
|
+
**[Live Demo](https://tungstenstudio.gitlab.io/libs/outschart-generator/)**
|
|
6
|
+
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
9
|
- **Instant lookups** — pre-computed double-out and single-out charts, zero computation
|
|
8
10
|
- **Generation engine** — brute-force enumerate all possible checkouts (82K double-out, 242K single-out)
|
|
9
11
|
- **Miss-aware recommendations** — scoring algorithm using physical dartboard layout, segment areas, and bust risk
|
|
10
|
-
- **Preferred targets** — filter checkouts to your favorite finishing doubles/targets
|
|
11
12
|
- **Notation presets** — format charts for different regional conventions (british, american, or custom)
|
|
12
13
|
- **Zero dependencies** — pure TypeScript, works in Node.js and browsers
|
|
13
14
|
|
|
@@ -85,14 +86,6 @@ const result = generateRecommended({
|
|
|
85
86
|
});
|
|
86
87
|
```
|
|
87
88
|
|
|
88
|
-
#### `filterByPreferredTargets(checkouts, preferredTargets)`
|
|
89
|
-
Filters enumerated checkouts to only those finishing on preferred targets.
|
|
90
|
-
|
|
91
|
-
```ts
|
|
92
|
-
const all = generateAllCheckouts({ outMode: 'double' });
|
|
93
|
-
const filtered = filterByPreferredTargets(all.checkouts, ['D20', 'D16']);
|
|
94
|
-
```
|
|
95
|
-
|
|
96
89
|
### Notation / Internationalization
|
|
97
90
|
|
|
98
91
|
#### `formatDart(dart, notation)`
|
|
@@ -163,10 +156,6 @@ Inverse of `parseTarget` — formats a bed/number pair into label and value.
|
|
|
163
156
|
- `NotationMap` — `{ treble: string; double: string; single: string; bull: string; outerBull: string }`
|
|
164
157
|
- `OutsChartError` — Custom error class with semantic codes
|
|
165
158
|
|
|
166
|
-
## Demo
|
|
167
|
-
|
|
168
|
-
See the [live demo](https://tungstenstudio.gitlab.io/libs/outschart-generator/) for an interactive chart with preferred targets and export.
|
|
169
|
-
|
|
170
159
|
## Development
|
|
171
160
|
|
|
172
161
|
```bash
|
package/dist/index.cjs
CHANGED
|
@@ -22,7 +22,6 @@ var index_exports = {};
|
|
|
22
22
|
__export(index_exports, {
|
|
23
23
|
NOTATIONS: () => NOTATIONS,
|
|
24
24
|
OutsChartError: () => OutsChartError,
|
|
25
|
-
filterByPreferredTargets: () => filterByPreferredTargets,
|
|
26
25
|
formatCheckoutChart: () => formatCheckoutChart,
|
|
27
26
|
formatDart: () => formatDart,
|
|
28
27
|
formatTarget: () => formatTarget,
|
|
@@ -1053,7 +1052,7 @@ function generateRecommended(options) {
|
|
|
1053
1052
|
const isDoubleOut = outMode === "double";
|
|
1054
1053
|
const min = options.min ?? (isDoubleOut ? 2 : 1);
|
|
1055
1054
|
const max = options.max ?? (isDoubleOut ? 170 : 180);
|
|
1056
|
-
const includeAlternates = options.includeAlternates ??
|
|
1055
|
+
const includeAlternates = options.includeAlternates ?? false;
|
|
1057
1056
|
const altThreshold = options.altThreshold ?? 1;
|
|
1058
1057
|
const overrides = {};
|
|
1059
1058
|
if (!isDoubleOut) {
|
|
@@ -1098,34 +1097,6 @@ function generateRecommended(options) {
|
|
|
1098
1097
|
return { checkouts, bogeyNumbers };
|
|
1099
1098
|
}
|
|
1100
1099
|
|
|
1101
|
-
// src/filter.ts
|
|
1102
|
-
function normalizeTargetLabel(str) {
|
|
1103
|
-
if (str === "Bull") return "Bull";
|
|
1104
|
-
if (str === "25") return "25";
|
|
1105
|
-
const m = str.match(/^([SDT])(\d+)$/);
|
|
1106
|
-
if (m) {
|
|
1107
|
-
return m[1] === "S" ? m[2] : `${m[1]}${m[2]}`;
|
|
1108
|
-
}
|
|
1109
|
-
if (/^\d+$/.test(str)) return str;
|
|
1110
|
-
return str;
|
|
1111
|
-
}
|
|
1112
|
-
function filterByPreferredTargets(checkouts, preferredTargets) {
|
|
1113
|
-
const preferredLabels = new Set(preferredTargets.map(normalizeTargetLabel));
|
|
1114
|
-
const filtered = {};
|
|
1115
|
-
for (const [score, entry] of Object.entries(checkouts)) {
|
|
1116
|
-
const matching = entry.options.filter(
|
|
1117
|
-
(darts) => preferredLabels.has(darts[darts.length - 1])
|
|
1118
|
-
);
|
|
1119
|
-
if (matching.length > 0) {
|
|
1120
|
-
filtered[Number(score)] = {
|
|
1121
|
-
options: matching,
|
|
1122
|
-
count: matching.length
|
|
1123
|
-
};
|
|
1124
|
-
}
|
|
1125
|
-
}
|
|
1126
|
-
return filtered;
|
|
1127
|
-
}
|
|
1128
|
-
|
|
1129
1100
|
// src/notation.ts
|
|
1130
1101
|
var NOTATIONS = {
|
|
1131
1102
|
default: { treble: "T", double: "D", single: "", bull: "Bull", outerBull: "25" },
|
|
@@ -1179,7 +1150,6 @@ function resolveNotation(notation) {
|
|
|
1179
1150
|
0 && (module.exports = {
|
|
1180
1151
|
NOTATIONS,
|
|
1181
1152
|
OutsChartError,
|
|
1182
|
-
filterByPreferredTargets,
|
|
1183
1153
|
formatCheckoutChart,
|
|
1184
1154
|
formatDart,
|
|
1185
1155
|
formatTarget,
|