Skip to content

Commit

Permalink
update deps
Browse files Browse the repository at this point in the history
  • Loading branch information
scheibo committed Mar 1, 2024
1 parent e125812 commit b8db700
Show file tree
Hide file tree
Showing 13 changed files with 110 additions and 110 deletions.
6 changes: 3 additions & 3 deletions anon/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pkmn/anon",
"version": "0.1.13",
"version": "0.1.14",
"description": "Logic for anonymizing Pokémon Showdown battle simulator logs",
"repository": "github:pkmn/stats",
"license": "MIT",
Expand All @@ -16,11 +16,11 @@
"access": "public"
},
"dependencies": {
"@pkmn/data": "^0.8.7",
"@pkmn/data": "^0.8.9",
"@pkmn/protocol": "^0.6.19"
},
"devDependencies": {
"@pkmn/dex": "^0.8.7"
"@pkmn/dex": "^0.8.9"
},
"scripts": {
"lint": "eslint --cache src --ext ts",
Expand Down
4 changes: 2 additions & 2 deletions anon/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ export interface Rating {
rprd: number;
}

type Writeable<T> = { -readonly [P in keyof T]: T[P] };
type Writeable<T> = {-readonly [P in keyof T]: T[P]};

export const Anonymizer = new class {
anonymize(
Expand Down Expand Up @@ -476,7 +476,7 @@ function copyPokemonSet(pokemon: PokemonSet) {
// than negatives here.
export class Verifier {
readonly names: Set<string> = new Set();
readonly leaks: Array<{ input: string; output: string }> = [];
readonly leaks: Array<{input: string; output: string}> = [];

private regex: RegExp | undefined = undefined;

Expand Down
20 changes: 10 additions & 10 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
"license": "MIT",
"dependencies": {
"@pkmn/anon": "file:anon",
"@pkmn/data": "^0.8.7",
"@pkmn/dex": "^0.8.7",
"@pkmn/data": "^0.8.9",
"@pkmn/dex": "^0.8.9",
"@pkmn/logs": "file:logs",
"@pkmn/stats": "file:stats",
"json-stringify-pretty-compact": "3.0.0",
Expand All @@ -17,19 +17,19 @@
"@pkmn/sets": "^5.1.2"
},
"devDependencies": {
"@babel/preset-env": "^7.23.9",
"@babel/preset-env": "^7.24.0",
"@babel/preset-typescript": "^7.23.3",
"@pkmn/eslint-config": "^6.6.0",
"@pkmn/eslint-config": "^7.1.0",
"@types/jest": "^29.5.12",
"@types/node": "^20.11.16",
"@typescript-eslint/eslint-plugin": "^6.20.0",
"@typescript-eslint/parser": "^6.20.0",
"eslint": "^8.56.0",
"@types/node": "^20.11.24",
"@typescript-eslint/eslint-plugin": "^7.1.0",
"@typescript-eslint/parser": "^7.1.0",
"eslint": "^8.57.0",
"eslint-plugin-import": "^2.29.1",
"eslint-plugin-jest": "^27.6.3",
"eslint-plugin-jest": "^27.9.0",
"jest": "^29.7.0",
"subpkg": "^4.1.0",
"tsup": "^8.0.1",
"tsup": "^8.0.2",
"typescript": "^5.3.3"
},
"subPackages": ["anon", "logs", "stats"],
Expand Down
6 changes: 3 additions & 3 deletions stats/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@pkmn/stats",
"version": "0.2.15",
"version": "0.2.16",
"description": "Logic for processing usage stats from Pokémon Showdown battle simulator logs",
"repository": "github:pkmn/stats",
"license": "MIT",
Expand All @@ -16,10 +16,10 @@
"access": "public"
},
"dependencies": {
"@pkmn/data": "^0.8.7"
"@pkmn/data": "^0.8.9"
},
"devDependencies": {
"@pkmn/dex": "^0.8.7",
"@pkmn/dex": "^0.8.9",
"json-stringify-pretty-compact": "3.0.0"
},
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion stats/src/binary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const enum EndType {
TIE = 1,
FORFEIT = 2,
FORCED_WIN = 3,
FORCED_TIE = 4,
FORCED_TIE = 4
}

const LE = (() => {
Expand Down
2 changes: 1 addition & 1 deletion stats/src/classifier.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export const Classifier = new class {
const originalAbility = pokemon.ability;

const species = util.getSpecies(gen, pokemon.species, legacy);
let mega: { species: ID; ability: ID } | undefined;
let mega: {species: ID; ability: ID} | undefined;
if (util.isMega(species, legacy)) {
mega = {
species: toID(species.name),
Expand Down
70 changes: 35 additions & 35 deletions stats/src/display.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const R = (v: number) => util.round(v, 1e4);

export interface DisplayStatistics<T = DisplayUsageStatistics> {
battles: number;
pokemon: { [name: string]: T };
pokemon: {[name: string]: T};
metagame?: DisplayMetagameStatistics;
}

Expand All @@ -23,22 +23,22 @@ export interface DisplayUsageStatistics {
weight: number | null;
viability: [number, number, number, number];

abilities: { [name: string]: number };
items: { [name: string]: number };
stats: { [stats: string]: number };
moves: { [name: string]: number };
teammates: { [name: string]: number };
counters: { [name: string]: [number, number, number] };
abilities: {[name: string]: number};
items: {[name: string]: number};
stats: {[stats: string]: number};
moves: {[name: string]: number};
teammates: {[name: string]: number};
counters: {[name: string]: [number, number, number]};
}

export interface LegacyDisplayUsageStatistics
extends Omit<DisplayUsageStatistics, 'unique' | 'win' | 'stats'> {
happinesses?: { [happiness: string]: number };
spreads: { [spreads: string]: number };
happinesses?: {[happiness: string]: number};
spreads: {[spreads: string]: number};
}

export interface DisplayMetagameStatistics {
tags: { [tag: string]: number };
tags: {[tag: string]: number};
stalliness: {
histogram: Array<[number, number]>;
mean: number;
Expand All @@ -55,29 +55,29 @@ export interface DetailedUsageStatistics {
'team type': ID | null;
'number of battles': number;
};
data: { [name: string]: DetailedMovesetStatistics };
data: {[name: string]: DetailedMovesetStatistics};
}

export interface DetailedMovesetStatistics {
'Raw count': number;
usage: number;
// num GXE, max GXE, 1% GXE, 20% GXE
'Viability Ceiling': [number, number, number, number];
Abilities: { [ability: string]: number };
Items: { [item: string]: number };
Spreads: { [spread: string]: number };
Happiness?: { [happiness: string]: number };
Moves: { [move: string]: number };
Abilities: {[ability: string]: number};
Items: {[item: string]: number};
Spreads: {[spread: string]: number};
Happiness?: {[happiness: string]: number};
Moves: {[move: string]: number};
// FIXME: this changed 2021-04 from deltas to raw usage
Teammates: { [pokemon: string]: number };
Teammates: {[pokemon: string]: number};
// n = sum(POKE1_KOED...DOUBLE_SWITCH)
// p = POKE1_KOED + POKE1_SWITCHED_OUT / n
// d = sqrt((p * (1 - p)) / n)
'Checks and Counters': { [pokemon: string]: [number, number, number] };
'Checks and Counters': {[pokemon: string]: [number, number, number]};
}

// Corrections for Pokémon who have had their names changed over time by developers.
const FIX: {[id: string]: string } = {
const FIX: {[id: string]: string} = {
mimikyutotembusted: 'mimikyubustedtotem',
};

Expand All @@ -101,7 +101,7 @@ export const Display = new class {

const unique = computeUnique(stats.pokemon);

const pokemon: { [name: string]: DisplayUsageStatistics } = {};
const pokemon: {[name: string]: DisplayUsageStatistics} = {};
for (const [species, p] of q) {
if (species === 'empty') continue;
const usage = calcUsage(p.usage, stats.usage, 6);
Expand Down Expand Up @@ -143,7 +143,7 @@ export const Display = new class {
(a, b) => b[1] - a[1] || a[0].localeCompare(b[0])
);
const W = Math.max(1.0, stats.usage.weighted);
const tags: { [id: string]: number } = {};
const tags: {[id: string]: number} = {};
for (const [tag, weight] of ts) {
const r = R(weight / W);
if (!r) break;
Expand Down Expand Up @@ -179,7 +179,7 @@ export const Display = new class {
const mr = metagameReport ? parseMetagameReport(metagameReport) : undefined;
const lr = leadsReport ? parseLeadsReport(leadsReport) : undefined;

const pokemon: { [name: string]: LegacyDisplayUsageStatistics } = {};
const pokemon: {[name: string]: LegacyDisplayUsageStatistics} = {};
for (const [species, {weight: w, outcomes}] of Object.entries(pmr)) {
if (species === 'empty') continue;
const p = dr.data[species];
Expand All @@ -205,7 +205,7 @@ export const Display = new class {
lead.real = lead.raw;
}

const scored: { [name: string]: {score: number; val: [number, number, number]} } = {};
const scored: {[name: string]: {score: number; val: [number, number, number]}} = {};
for (const [k, [n]] of Object.entries(p['Checks and Counters'])) {
if (!outcomes[k]) continue;
const {koedn, switchedn} = outcomes[k];
Expand Down Expand Up @@ -253,7 +253,7 @@ export const Display = new class {

let metagame: DisplayMetagameStatistics | undefined = undefined;
if (mr) {
const tags: { [tag: string]: number } = {};
const tags: {[tag: string]: number} = {};
for (const tag in mr.tags) {
const r = R(mr.tags[tag]);
if (!r) break;
Expand Down Expand Up @@ -292,11 +292,11 @@ function formatEncounterStatistics(v: util.EncounterStatistics) {
}

function toDisplayObject(
map: { [k: string /* number|ID */]: number },
map: {[k: string /* number|ID */]: number},
weight: number,
display?: (id: string) => string
) {
const obj: { [key: string]: number } = {};
const obj: {[key: string]: number} = {};
const d = (k: number | string) => (typeof k === 'string' && display ? display(k) : k.toString());
const sorted = Object.entries(map).sort((a, b) => b[1] - a[1] || d(a[0]).localeCompare(d(b[0])));
for (const [k, v] of sorted) {
Expand All @@ -310,13 +310,13 @@ function toDisplayObject(
function getTeammates(
gen: Generation,
// format: ID,
teammates: { [id: string /* ID */]: number },
teammates: {[id: string /* ID */]: number},
weight: number,
// total: number,
stats: Statistics
): { [key: string]: number } {
): {[key: string]: number} {
// const real = ['challengecup1v1', '1v1'].includes(format);
const m: { [species: string]: number } = {};
const m: {[species: string]: number} = {};
for (const [id, w] of Object.entries(teammates)) {
const species = gen.species.get(id)?.name;
if (!species) continue;
Expand All @@ -332,9 +332,9 @@ function getTeammates(
return toDisplayObject(m, weight);
}

function computeUnique(stats: { [id: string /* ID */]: UsageStatistics }) {
const pokemon: { [id: string /* ID */]: { usage: Usage; gxes: number[] } } = {};
const all: { [id: string /* ID */]: UniqueStatistics } = {};
function computeUnique(stats: {[id: string /* ID */]: UsageStatistics}) {
const pokemon: {[id: string /* ID */]: {usage: Usage; gxes: number[]}} = {};
const all: {[id: string /* ID */]: UniqueStatistics} = {};

for (const p in stats) {
const usage = newUsage();
Expand Down Expand Up @@ -374,7 +374,7 @@ interface UsageReportRowData {
}

function parseUsageReport(report: string) {
const usage: { [id: string]: UsageReportRowData } = {};
const usage: {[id: string]: UsageReportRowData} = {};
const lines = report.split('\n');
const battles = Number(lines[0].slice(16));
const avg = Number(lines[1].slice(19));
Expand All @@ -401,7 +401,7 @@ interface LeadsReportRowData {
}

function parseLeadsReport(report: string) {
const usage: { [id: string]: LeadsReportRowData } = {};
const usage: {[id: string]: LeadsReportRowData} = {};
const lines = report.split('\n');
const total = Number(lines[0].slice(13));

Expand Down Expand Up @@ -459,7 +459,7 @@ function partialParseMovesetReport(report: string) {
}

function parseMetagameReport(report: string) {
const tags: { [tag: string]: number } = {};
const tags: {[tag: string]: number} = {};
const lines = report.split('\n');

let i = 0;
Expand Down
8 changes: 4 additions & 4 deletions stats/src/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export interface Player {

export interface Team {
pokemon: Pokemon[];
classification: { bias: number; stalliness: number; tags: Set<ID> };
classification: {bias: number; stalliness: number; tags: Set<ID>};
}

export interface Pokemon {
Expand Down Expand Up @@ -83,7 +83,7 @@ export const Parser = new class {
}
if (raw.p1 === raw.p2) throw new Error('Player battling themself');

const idents: { p1: string[]; p2: string[] } = {p1: [], p2: []};
const idents: {p1: string[]; p2: string[]} = {p1: [], p2: []};
const battle = ({
matchups: [],
turns: raw.turns,
Expand Down Expand Up @@ -129,7 +129,7 @@ export const Parser = new class {
switch: {p1: false, p2: false},
});

const active: { p1?: Slot; p2?: Slot } = {};
const active: {p1?: Slot; p2?: Slot} = {};
let flags = emptyFlags();
let turnMatchups: Array<[ID, ID, Outcome]> = [];

Expand Down Expand Up @@ -347,7 +347,7 @@ function identify(
name: string,
side: 'p1' | 'p2',
battle: Battle,
idents: { p1: string[]; p2: string[] },
idents: {p1: string[]; p2: string[]},
legacy: boolean,
) {
const team = battle[side].team.pokemon;
Expand Down
Loading

0 comments on commit b8db700

Please sign in to comment.