step-sequence-generator
Version:
A step sequence generator for figure skating programs
29 lines (28 loc) • 1.24 kB
TypeScript
import { NumberGenerator, WeightKeyCreatorType } from './number-generator/NumberGenerator';
import { ItemKeyExtractorType, WeightCalculator } from './weight-calculator/WeightCalculator';
import { ChanceRatioMap } from '../../shared/types/roulette/chance-ratio-map.type';
export type RouletteConstructorArgsType = {
weightCalc: WeightCalculator;
numberGenerator: NumberGenerator;
};
export type SpinWheelArgsType<S, M> = {
selection: S[];
chanceRatioMap: ChanceRatioMap<M>;
itemKeyExtractor: ItemKeyExtractorType<S, M>;
weightKeyCreator: WeightKeyCreatorType<S, M>;
};
export declare class Roulette {
private weightCalc;
private numberGenerator;
constructor(args: RouletteConstructorArgsType);
/**
* spinWheel
* @arg args
* @arg args.selection элементы
* @arg args.chanceRatioMap шансы на выпадение элемента в selection в процентах
* @arg args.itemKeyExtractor callback для опредления ключа для weightMap
* @arg args.weightKeyCreator callback для опредления ключа в weightMap
*/
spinWheel<S, M>(args: SpinWheelArgsType<S, M>): number;
setFallbackWeight(value: number): void;
}