Skip to content

Map list generator · Modules

1 module · 3 exports · 0 repositories · 5 e2e tests · 1 route

Who imports who · hover a node
Depends onMap list generator modulesUsed byMapList3 exportsRoutes1 fileScrimMapByMapscrimsOther3 files

MapList

app/features/map-list-generator/core/MapList.ts

No overview comment at the top of the file.

Imports
no other modules
Used by
1 route1 module3 other

Functions & values

function

modeStageKey

:29

Unique key of a mode-stage combination, e.g. modeStageKey("SZ", 1) gives "SZ-1".

export function modeStageKey(mode: ModeShort, stageId: StageId): string
function

generate

:42

Generates map lists avoiding stage repeats, optionally following a mode pattern.

  • @example

    const generator = generate({ mapPool: new MapPool(pool) }); generator.next(); const firstSet = generator.next({ amount: 5 }).value; const secondSet = generator.next({ amount: 3, pattern: "SZ*TC" }).value; // remembers stages used in firstSet

export function* generate(args: {
	mapPool: MapPool;
	/** Bias towards maps not guaranteed to be played (e.g. maps 4 & 5 of a Bo5). True for best of formats. */
	considerGuaranteed?: boolean;
	/** Initial weights keyed by `modeStageKey`. Negative weights deprioritize maps. */
	initialWeights?: Map<string, number>;
	/** Skip inflating weights so half the pool is available, e.g. when initial weights already define the selection. */
	skipEnsureMinimumCandidates?: boolean;
	/** Fixed mode order instead of a random shuffle. Intended for `resume`. */
	modeOrder?: ModeShort[];
	/** Mode-agnostic initial stage weights, how `resume` carries over stage-level penalties from history. */
	initialStageWeights?: Map<StageId, number>;
	/** Filters per map index of a set, tried in order. The first one leaving any candidate narrows the draw. */
	candidateFilters?: (index: number) => Array<(map: ModeWithStage) => boolean>;
}): Generator<Array<ModeWithStage>, Array<ModeWithStage>, GenerateNext>
Unit tests (35)
function

resume

:152

Generator primed to continue after history: mode order kept stable (rotated so the next mode is first) and played (mode, stage) pairs avoided unless every option in that mode was played.

  • @example

    const generator = resume({ mapPool, history }); generator.next(); const { mode, stageId } = generator.next({ amount: 1 }).value![0];

export function resume(args: {
	mapPool: MapPool;
	history: Array<{ mode: ModeShort; stageId: StageId }>;
})
Unit tests (6)
Unit tests not about one export (19)

Not shown, only used by tests: parsePattern