I am trying to port an npm package for pairing algorithm for tournaments. However the package is heavily encased in classes with Player, Game, Round all having functions that are required to use pairing algorithm.
Is there a way to save the class objects themselves without having to brute force the data every time a round needs to run? For example
Player class:
class Player {
id: number;
rating: number;
games: Game[];
initialScore: number;
roundScores: number[];
score: number;
state: string;
city: string;
club: string;
family: string;
constructor(id: number, initialScore: number, rating: number) {
this.id = id;
this.initialScore = initialScore;
this.games = [];
this.roundScores = [];
this.score = initialScore;
this.rating = rating;
}
I can have a data structure in bubble 1 to 1 to this but it doesn’t cover the functions used. Nor the order of events that it happens.
How do I have persistent data without having to recreate the classes everytime