@pkmn/stats 0.0.2 → 0.1.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/CHANGES.md +90 -0
- package/README.md +11 -7
- package/build/aliases.json +1 -0
- package/build/binary.d.ts +137 -0
- package/build/binary.js +386 -0
- package/build/binary.js.map +1 -0
- package/build/classifier.d.ts +2 -2
- package/build/classifier.js +45 -39
- package/build/classifier.js.map +1 -1
- package/build/data.d.ts +39 -0
- package/build/data.js +126 -0
- package/build/data.js.map +1 -0
- package/build/display.d.ts +1 -1
- package/build/display.js +18 -8
- package/build/display.js.map +1 -1
- package/build/index.d.ts +1 -0
- package/build/index.js +3 -1
- package/build/index.js.map +1 -1
- package/build/parser.d.ts +2 -2
- package/build/parser.js +55 -37
- package/build/parser.js.map +1 -1
- package/build/pkmn/data.d.ts +39 -0
- package/build/pkmn/data.js +126 -0
- package/build/pkmn/data.js.map +1 -0
- package/build/pkmn/index.d.ts +1 -0
- package/build/pkmn/index.js +18 -0
- package/build/pkmn/index.js.map +1 -0
- package/build/reports.d.ts +2 -2
- package/build/reports.js +27 -20
- package/build/reports.js.map +1 -1
- package/build/smogon/aliases.json +227 -0
- package/build/smogon/classifier.d.ts +12 -0
- package/build/smogon/classifier.js +556 -0
- package/build/smogon/classifier.js.map +1 -0
- package/build/smogon/display.d.ts +96 -0
- package/build/smogon/display.js +412 -0
- package/build/smogon/display.js.map +1 -0
- package/build/smogon/index.d.ts +6 -0
- package/build/smogon/index.js +19 -0
- package/build/smogon/index.js.map +1 -0
- package/build/smogon/parser.d.ts +57 -0
- package/build/smogon/parser.js +358 -0
- package/build/smogon/parser.js.map +1 -0
- package/build/smogon/reports.d.ts +51 -0
- package/build/smogon/reports.js +652 -0
- package/build/smogon/reports.js.map +1 -0
- package/build/smogon/stats.d.ts +119 -0
- package/build/smogon/stats.js +521 -0
- package/build/smogon/stats.js.map +1 -0
- package/build/smogon/test/integration.d.ts +30 -0
- package/build/smogon/test/integration.js +179 -0
- package/build/smogon/test/integration.js.map +1 -0
- package/build/smogon/test/integration.test.d.ts +1 -0
- package/build/smogon/test/integration.test.js +38 -0
- package/build/smogon/test/integration.test.js.map +1 -0
- package/build/smogon/test/parser.test.d.ts +1 -0
- package/build/smogon/test/parser.test.js +91 -0
- package/build/smogon/test/parser.test.js.map +1 -0
- package/build/smogon/util.d.ts +63 -0
- package/build/smogon/util.js +400 -0
- package/build/smogon/util.js.map +1 -0
- package/build/stats.d.ts +3 -3
- package/build/stats.js +34 -34
- package/build/stats.js.map +1 -1
- package/build/util.d.ts +7 -7
- package/build/util.js +42 -32
- package/build/util.js.map +1 -1
- package/package.json +11 -14
- package/src/aliases.json +1 -0
- package/src/binary.ts +514 -0
- package/src/classifier.ts +38 -37
- package/src/display.ts +12 -14
- package/src/index.ts +6 -17
- package/src/parser.ts +39 -22
- package/src/reports.ts +22 -21
- package/src/stats.ts +27 -24
- package/src/util.ts +39 -39
|
@@ -0,0 +1,179 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
28
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
+
exports.compare = exports.update = exports.process = void 0;
|
|
30
|
+
const fs = __importStar(require("fs"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const json_stringify_pretty_compact_1 = __importDefault(require("json-stringify-pretty-compact"));
|
|
33
|
+
const dex_1 = require("@pkmn/dex");
|
|
34
|
+
const data_1 = require("@pkmn/data");
|
|
35
|
+
const stats = __importStar(require("../index"));
|
|
36
|
+
const util_1 = require("../util");
|
|
37
|
+
const TESTDATA = path.resolve(__dirname.replace('build', 'src'), 'testdata');
|
|
38
|
+
// const MONTHS: [string, string, string] = [
|
|
39
|
+
// path.resolve(TESTDATA, 'stats', '2018-06'),
|
|
40
|
+
// path.resolve(TESTDATA, 'stats', '2018-05'),
|
|
41
|
+
// path.resolve(TESTDATA, 'stats', '2018-04'),
|
|
42
|
+
// ];
|
|
43
|
+
const UPDATE = path.resolve(TESTDATA, 'stats', 'update.txt');
|
|
44
|
+
const CUTOFFS = [0, 1500, 1630, 1760];
|
|
45
|
+
function process() {
|
|
46
|
+
const gens = (0, util_1.newGenerations)(dex_1.Dex);
|
|
47
|
+
const base = path.resolve(TESTDATA, 'logs');
|
|
48
|
+
const parsed = new Map();
|
|
49
|
+
for (const dir of fs.readdirSync(base)) {
|
|
50
|
+
const format = (0, data_1.toID)(dir);
|
|
51
|
+
const battles = [];
|
|
52
|
+
for (const log of fs.readdirSync(path.resolve(base, dir))) {
|
|
53
|
+
const raw = JSON.parse(fs.readFileSync(path.resolve(base, dir, log), 'utf8'));
|
|
54
|
+
const gen = (0, util_1.genForFormat)(gens, format);
|
|
55
|
+
battles.push(stats.Parser.parse(gen, format, raw, true));
|
|
56
|
+
}
|
|
57
|
+
parsed.set(format, battles);
|
|
58
|
+
}
|
|
59
|
+
const formats = new Map();
|
|
60
|
+
for (const [format, battles] of parsed.entries()) {
|
|
61
|
+
const gen = (0, util_1.genForFormat)(gens, format);
|
|
62
|
+
const taggedStats = { total: {}, tags: {} };
|
|
63
|
+
for (const battle of battles) {
|
|
64
|
+
stats.Stats.updateTagged(gen, format, battle, CUTOFFS, taggedStats, true /* , TAGS */);
|
|
65
|
+
}
|
|
66
|
+
const trs = { total: new Map(), tags: new Map() };
|
|
67
|
+
for (const [c, s] of Object.entries(taggedStats.total)) {
|
|
68
|
+
const cutoff = Number(c);
|
|
69
|
+
trs.total.set(cutoff, createReports(gen, format, s, cutoff));
|
|
70
|
+
}
|
|
71
|
+
for (const [t, ts] of Object.entries(taggedStats.tags)) {
|
|
72
|
+
const wrs = new Map();
|
|
73
|
+
for (const [c, s] of Object.entries(ts)) {
|
|
74
|
+
const cutoff = Number(c);
|
|
75
|
+
wrs.set(cutoff, createReports(gen, format, s, cutoff, t));
|
|
76
|
+
}
|
|
77
|
+
trs.tags.set(t, wrs);
|
|
78
|
+
}
|
|
79
|
+
formats.set(format, trs);
|
|
80
|
+
}
|
|
81
|
+
// TODO: add test data for gen8ou and figure out a stable way to test
|
|
82
|
+
// const tiers = await stats.Reports.tierUpdateReport(gens.get(8), MONTHS, (month, format) => {
|
|
83
|
+
// const baseline = format.startsWith('gen8ou') ? 1695 : 1630;
|
|
84
|
+
// const file = path.resolve(`${month}`, `${format}-${baseline}.txt`);
|
|
85
|
+
// return new Promise((resolve, reject) => {
|
|
86
|
+
// fs.readFile(file, 'utf8', (err, data) => {
|
|
87
|
+
// if (err) {
|
|
88
|
+
// return err.code === 'ENOENT' ? resolve(undefined) : reject(err);
|
|
89
|
+
// }
|
|
90
|
+
// resolve(data);
|
|
91
|
+
// });
|
|
92
|
+
// });
|
|
93
|
+
// });
|
|
94
|
+
return { formats, tiers: '' };
|
|
95
|
+
}
|
|
96
|
+
exports.process = process;
|
|
97
|
+
function update(reports) {
|
|
98
|
+
const dir = path.resolve(TESTDATA, 'reports');
|
|
99
|
+
rmrf(dir);
|
|
100
|
+
fs.mkdirSync(dir);
|
|
101
|
+
for (const [format, taggedReports] of reports.formats.entries()) {
|
|
102
|
+
const d = path.resolve(dir, format);
|
|
103
|
+
fs.mkdirSync(d);
|
|
104
|
+
for (const [c, rs] of taggedReports.total.entries()) {
|
|
105
|
+
writeReports(d, rs, c);
|
|
106
|
+
}
|
|
107
|
+
for (const [t, trs] of taggedReports.tags.entries()) {
|
|
108
|
+
const td = path.resolve(d, t);
|
|
109
|
+
fs.mkdirSync(td);
|
|
110
|
+
for (const [c, rs] of trs.entries()) {
|
|
111
|
+
writeReports(td, rs, c);
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
if (reports.tiers)
|
|
116
|
+
fs.writeFileSync(UPDATE, reports.tiers);
|
|
117
|
+
}
|
|
118
|
+
exports.update = update;
|
|
119
|
+
function compare(reports, cmp) {
|
|
120
|
+
const dir = path.resolve(TESTDATA, 'reports');
|
|
121
|
+
for (const [format, taggedReports] of reports.formats.entries()) {
|
|
122
|
+
const d = path.resolve(dir, format);
|
|
123
|
+
for (const [c, rs] of taggedReports.total.entries()) {
|
|
124
|
+
compareReports(d, rs, c, cmp);
|
|
125
|
+
}
|
|
126
|
+
for (const [t, trs] of taggedReports.tags.entries()) {
|
|
127
|
+
const td = path.resolve(d, t);
|
|
128
|
+
for (const [c, rs] of trs.entries()) {
|
|
129
|
+
compareReports(td, rs, c, cmp);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
if (reports.tiers)
|
|
134
|
+
cmp(UPDATE, reports.tiers, fs.readFileSync(UPDATE, 'utf8'));
|
|
135
|
+
}
|
|
136
|
+
exports.compare = compare;
|
|
137
|
+
function createReports(gen, format, s, cutoff, tag = null) {
|
|
138
|
+
return {
|
|
139
|
+
usage: stats.Reports.usageReport(gen, format, s),
|
|
140
|
+
leads: stats.Reports.leadsReport(gen, s),
|
|
141
|
+
movesets: stats.Reports.movesetReports(gen, format, s, cutoff, tag, [0, -Infinity]),
|
|
142
|
+
metagame: stats.Reports.metagameReport(s),
|
|
143
|
+
display: (0, json_stringify_pretty_compact_1.default)(stats.Display.fromStatistics(gen, format, s, 0)),
|
|
144
|
+
};
|
|
145
|
+
}
|
|
146
|
+
function writeReports(dir, reports, cutoff) {
|
|
147
|
+
eachReport(reports, cutoff, (name, data) => {
|
|
148
|
+
fs.writeFileSync(path.resolve(dir, name), data);
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
function compareReports(dir, reports, cutoff, cmp) {
|
|
152
|
+
eachReport(reports, cutoff, (name, data) => {
|
|
153
|
+
const file = path.resolve(dir, name);
|
|
154
|
+
cmp(file, data, fs.readFileSync(file, 'utf8'));
|
|
155
|
+
});
|
|
156
|
+
}
|
|
157
|
+
function eachReport(reports, cutoff, fn) {
|
|
158
|
+
fn(`usage.${cutoff}.txt`, reports.usage);
|
|
159
|
+
fn(`leads.${cutoff}.txt`, reports.leads);
|
|
160
|
+
fn(`movesets.${cutoff}.txt`, reports.movesets.basic);
|
|
161
|
+
fn(`detailed.${cutoff}.json`, reports.movesets.detailed);
|
|
162
|
+
fn(`metagame.${cutoff}.txt`, reports.metagame);
|
|
163
|
+
fn(`display.${cutoff}.json`, reports.display);
|
|
164
|
+
}
|
|
165
|
+
function rmrf(dir) {
|
|
166
|
+
if (fs.existsSync(dir)) {
|
|
167
|
+
for (const file of fs.readdirSync(dir)) {
|
|
168
|
+
const f = path.resolve(dir, file);
|
|
169
|
+
if (fs.lstatSync(f).isDirectory()) {
|
|
170
|
+
rmrf(f);
|
|
171
|
+
}
|
|
172
|
+
else {
|
|
173
|
+
fs.unlinkSync(f);
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
fs.rmdirSync(dir);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
//# sourceMappingURL=integration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.js","sourceRoot":"","sources":["../../../src/smogon/test/integration.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAC7B,kGAAsD;AAEtD,mCAA8B;AAC9B,qCAAgD;AAEhD,gDAAkC;AAClC,kCAAqD;AAErD,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAC7E,6CAA6C;AAC7C,gDAAgD;AAChD,gDAAgD;AAChD,gDAAgD;AAChD,KAAK;AACL,MAAM,MAAM,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,OAAO,EAAE,YAAY,CAAC,CAAC;AAC7D,MAAM,OAAO,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;AAiBtC,SAAgB,OAAO;IACrB,MAAM,IAAI,GAAG,IAAA,qBAAc,EAAC,SAAG,CAAC,CAAC;IAEjC,MAAM,IAAI,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IAC5C,MAAM,MAAM,GAA4B,IAAI,GAAG,EAAE,CAAC;IAClD,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,EAAE;QACtC,MAAM,MAAM,GAAG,IAAA,WAAI,EAAC,GAAG,CAAC,CAAC;QACzB,MAAM,OAAO,GAAmB,EAAE,CAAC;QACnC,KAAK,MAAM,GAAG,IAAI,EAAE,CAAC,WAAW,CAAC,IAAI,CAAC,OAAO,CAAC,IA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AAG,CAAC,EAAE;QACtB,KAAK,MAAM,IAAI,IAAI,EAAE,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE;YACtC,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAClC,IAAI,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,WAAW,EAAE,EAAE;gBACjC,IAAI,CAAC,CAAC,CAAC,CAAC;aACT;iBAAM;gBACL,EAAE,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC;aAClB;SACF;QACD,EAAE,CAAC,SAAS,CAAC,GAAG,CAAC,CAAC;KACnB;AACH,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const integration = __importStar(require("./integration"));
|
|
27
|
+
describe('Integration', () => {
|
|
28
|
+
test('process', () => {
|
|
29
|
+
const actual = {};
|
|
30
|
+
const expected = {};
|
|
31
|
+
integration.compare(integration.process(), (file, a, e) => {
|
|
32
|
+
actual[file] = a;
|
|
33
|
+
expected[file] = e;
|
|
34
|
+
});
|
|
35
|
+
expect(actual).toEqual(expected);
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
//# sourceMappingURL=integration.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"integration.test.js","sourceRoot":"","sources":["../../../src/smogon/test/integration.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2DAA6C;AAE7C,QAAQ,CAAC,aAAa,EAAE,GAAG,EAAE;IAC3B,IAAI,CAAC,SAAS,EAAE,GAAG,EAAE;QACnB,MAAM,MAAM,GAA+B,EAAE,CAAC;QAC9C,MAAM,QAAQ,GAA+B,EAAE,CAAC;QAChD,WAAW,CAAC,OAAO,CAAC,WAAW,CAAC,OAAO,EAAE,EAAE,CAAC,IAAY,EAAE,CAAS,EAAE,CAAS,EAAE,EAAE;YAChF,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACjB,QAAQ,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QACrB,CAAC,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACnC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
const fs = __importStar(require("fs"));
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const dex_1 = require("@pkmn/dex");
|
|
29
|
+
const parser_1 = require("../parser");
|
|
30
|
+
const util_1 = require("../util");
|
|
31
|
+
const TESTDATA = path.resolve(__dirname.replace('build', 'src'), 'testdata');
|
|
32
|
+
function setup() {
|
|
33
|
+
const GEN = (0, util_1.newGenerations)(dex_1.Dex).get(7);
|
|
34
|
+
const FORMAT = 'gen7anythinggoes';
|
|
35
|
+
const LOG = path.resolve(TESTDATA, 'logs', FORMAT, 'log.1.json');
|
|
36
|
+
const read = () => JSON.parse(fs.readFileSync(LOG, 'utf8'));
|
|
37
|
+
const parse = (log) => parser_1.Parser.parse(GEN, FORMAT, log, true);
|
|
38
|
+
return { read, parse };
|
|
39
|
+
}
|
|
40
|
+
describe('Parser', () => {
|
|
41
|
+
test('log = "log"', () => {
|
|
42
|
+
const { parse } = setup();
|
|
43
|
+
expect(() => {
|
|
44
|
+
parse('"log"');
|
|
45
|
+
}).toThrow('Log = "log"');
|
|
46
|
+
});
|
|
47
|
+
test('no turn count', () => {
|
|
48
|
+
const { read, parse } = setup();
|
|
49
|
+
expect(() => {
|
|
50
|
+
const raw = read();
|
|
51
|
+
delete raw.turns;
|
|
52
|
+
parse(raw);
|
|
53
|
+
}).toThrow('No turn count');
|
|
54
|
+
});
|
|
55
|
+
test('two winners', () => {
|
|
56
|
+
const { read, parse } = setup();
|
|
57
|
+
expect(() => {
|
|
58
|
+
const raw = read();
|
|
59
|
+
raw.log.push('|win|test-player-b');
|
|
60
|
+
parse(raw);
|
|
61
|
+
}).toThrow('Battle had two winners');
|
|
62
|
+
});
|
|
63
|
+
test('self battle', () => {
|
|
64
|
+
const { read, parse } = setup();
|
|
65
|
+
expect(() => {
|
|
66
|
+
const raw = read();
|
|
67
|
+
raw.p2 = raw.p1;
|
|
68
|
+
parse(raw);
|
|
69
|
+
}).toThrow('Player battling themself');
|
|
70
|
+
});
|
|
71
|
+
test('bad log', () => {
|
|
72
|
+
const { read, parse } = setup();
|
|
73
|
+
const raw = read();
|
|
74
|
+
const log = raw.log.slice();
|
|
75
|
+
for (const line of ['|move|Bad', '|switch|Bad']) {
|
|
76
|
+
expect(() => {
|
|
77
|
+
raw.log = log.slice().concat(line);
|
|
78
|
+
parse(raw);
|
|
79
|
+
}).toThrow(`Could not parse line: '${line}'`);
|
|
80
|
+
}
|
|
81
|
+
});
|
|
82
|
+
test('unknown species', () => {
|
|
83
|
+
const { read, parse } = setup();
|
|
84
|
+
expect(() => {
|
|
85
|
+
const raw = read();
|
|
86
|
+
raw.log.push('|switch|p1a: Oops|Oops|100/100');
|
|
87
|
+
parse(raw);
|
|
88
|
+
}).toThrow('Unknown species \'Oops\'');
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
//# sourceMappingURL=parser.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parser.test.js","sourceRoot":"","sources":["../../../src/smogon/test/parser.test.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAAA,uCAAyB;AACzB,2CAA6B;AAE7B,mCAAkC;AAElC,sCAAsC;AACtC,kCAAuC;AAEvC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,EAAE,UAAU,CAAC,CAAC;AAE7E,SAAS,KAAK;IACZ,MAAM,GAAG,GAAG,IAAA,qBAAc,EAAC,SAAG,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;IACvC,MAAM,MAAM,GAAG,kBAAwB,CAAC;IACxC,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,YAAY,CAAC,CAAC;IAEjE,MAAM,IAAI,GAAG,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,GAAG,EAAE,MAAM,CAAC,CAAC,CAAC;IAC5D,MAAM,KAAK,GAAG,CAAC,GAAQ,EAAE,EAAE,CAAC,eAAM,CAAC,KAAK,CAAC,GAAG,EAAE,MAAM,EAAE,GAAG,EAAE,IAAI,CAAC,CAAC;IACjE,OAAO,EAAC,IAAI,EAAE,KAAK,EAAC,CAAC;AACvB,CAAC;AAED,QAAQ,CAAC,QAAQ,EAAE,GAAG,EAAE;IACtB,IAAI,CAAC,aAAa,EAAE,GAAG,EAAE;QACvB,MAAM,EAAC,KAAK,EAAC,GAAG,KAAK,EAAE,CAAC;QACxB,MAAM,CAAC,GAAG,EAAE;YACV,KAAK,CAAE,OAA0B,CAAC,CAAC;QACrC,CAAC,CAAC,CAAC,O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E,CAAC;QACnB,MAAM,GAAG,GAAG,GAAG,CAAC,GAAG,CAAC,KAAK,EAAE,CAAC;QAC5B,KAAK,MAAM,IAAI,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,EAAE;YAC/C,MAAM,CAAC,GAAG,EAAE;gBACV,GAAG,CAAC,GAAG,GAAG,GAAG,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACnC,KAAK,CAAC,GAAG,CAAC,CAAC;YACb,CAAC,CAAC,CAAC,OAAO,CAAC,0BAA0B,IAAI,GAAG,CAAC,CAAC;SAC/C;IACH,CAAC,CAAC,CAAC;IACH,IAAI,CAAC,iBAAiB,EAAE,GAAG,EAAE;QAC3B,MAAM,EAAC,IAAI,EAAE,KAAK,EAAC,GAAG,KAAK,EAAE,CAAC;QAC9B,MAAM,CAAC,GAAG,EAAE;YACV,MAAM,GAAG,GAAG,IAAI,EAAE,CAAC;YACnB,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,gCAAgC,CAAC,CAAC;YAC/C,KAAK,CAAC,GAAG,CAAC,CAAC;QACb,CAAC,CAAC,CAAC,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACzC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { Generations, Generation, Dex, ID, PokemonSet, Specie } from '@pkmn/data';
|
|
2
|
+
export declare const PRECISION = 10000000000;
|
|
3
|
+
export declare const enum Outcome {
|
|
4
|
+
POKE1_KOED = 0,
|
|
5
|
+
POKE2_KOED = 1,
|
|
6
|
+
DOUBLE_DOWN = 2,
|
|
7
|
+
POKE1_SWITCHED_OUT = 3,
|
|
8
|
+
POKE2_SWITCHED_OUT = 4,
|
|
9
|
+
DOUBLE_SWITCH = 5,
|
|
10
|
+
POKE1_FORCED_OUT = 6,
|
|
11
|
+
POKE2_FORCED_OUT = 7,
|
|
12
|
+
POKE1_UTURN_KOED = 8,
|
|
13
|
+
POKE2_UTURN_KOED = 9,
|
|
14
|
+
POKE1_FODDERED = 10,
|
|
15
|
+
POKE2_FODDERED = 11,
|
|
16
|
+
UNKNOWN = 12
|
|
17
|
+
}
|
|
18
|
+
export declare function newGenerations(dex: Dex): Generations;
|
|
19
|
+
export declare function ignoreGen(gen: Generation, legacy: boolean): Generation;
|
|
20
|
+
export declare function fromAlias(name: string): string;
|
|
21
|
+
export declare function getSpecies(gen: Generation, name: string, legacy: boolean): Specie;
|
|
22
|
+
export declare function getBaseSpecies(gen: Generation, name: string, legacy: boolean): Specie;
|
|
23
|
+
export declare function genForFormat(gens: Generations, format: ID): Generation;
|
|
24
|
+
export declare function isMegaRayquazaAllowed(format: ID): boolean;
|
|
25
|
+
export declare function isMega(species: Specie, legacy: boolean): boolean | "";
|
|
26
|
+
export declare function getMegaEvolution(gen: Generation, pokemon: PokemonSet<string | ID>, legacy: boolean): {
|
|
27
|
+
species: ID;
|
|
28
|
+
ability: ID;
|
|
29
|
+
} | undefined;
|
|
30
|
+
export declare function revertFormes(gen: Generation, id: ID, legacy: boolean): ID;
|
|
31
|
+
export declare function isNonSinglesFormat(format: ID): boolean;
|
|
32
|
+
export declare function isNon6v6Format(format: ID): boolean;
|
|
33
|
+
export declare function canonicalizeFormat(format: ID): ID;
|
|
34
|
+
export declare function round(v: number, p?: number): number;
|
|
35
|
+
export declare function roundStr(v: number, p?: number): string;
|
|
36
|
+
export declare function displaySpecies(gen: Generation, name: string, legacy: boolean): string;
|
|
37
|
+
export declare function toDisplayObject(map: {
|
|
38
|
+
[k: string]: number;
|
|
39
|
+
}, display?: (id: string) => string, p?: number): {
|
|
40
|
+
[key: string]: number;
|
|
41
|
+
};
|
|
42
|
+
export declare function computeViability(gxes: number[]): [number, number, number, number];
|
|
43
|
+
export interface EncounterStatistics {
|
|
44
|
+
koed: number;
|
|
45
|
+
switched: number;
|
|
46
|
+
n: number;
|
|
47
|
+
p: number;
|
|
48
|
+
d: number;
|
|
49
|
+
score: number;
|
|
50
|
+
}
|
|
51
|
+
export declare function getChecksAndCounters<T>(encounters: {
|
|
52
|
+
[id: string]: number[];
|
|
53
|
+
}, display: [(id: string) => string, (es: EncounterStatistics) => T], min?: number): {
|
|
54
|
+
[key: string]: T;
|
|
55
|
+
};
|
|
56
|
+
export declare function stallinessHistogram(stalliness: Array<[number, number]>): {
|
|
57
|
+
histogram: number[][];
|
|
58
|
+
binSize: number;
|
|
59
|
+
mean: number;
|
|
60
|
+
total: number;
|
|
61
|
+
};
|
|
62
|
+
export declare function victoryChance(r1: number, d1: number, r2: number, d2: number): number;
|
|
63
|
+
export declare function weighting(rating: number, deviation: number, cutoff: number): number;
|