class Game { readonly code: string; #_players: players; public constructor(code: string, host: string) { this.code = code; this.#_players = {}; this.add_player(host, true); }; get players(): players { return this.#_players; }; public add_player(player: string, is_host:boolean=false): void { this.#_players[player] = { position: undefined, role: undefined, host: is_host }; }; public toString(): string { let players: string[] = []; for (var player in this.#_players) { let p: player = this.players[player]; players.push(`${player}(host=${p.host},pos=${p.position || 'none'},role=${p.role || 'none'}`); }; return `Game(code=${this.code},players=${players.join(',')})`; }; };