import { GameInstance } from './GameInstance'; export class GameManager { private games: Map; constructor() { this.games = new Map(); } createGame(): GameInstance { const game = new GameInstance(); this.games.set(game.id, game); return game; } getGame(gameId: string): GameInstance | null { return this.games.get(gameId) || null; } public joinGame(gameId: string, playerId: string): boolean { const game = this.games.get(gameId); if (!game) { return false; } return game.addPlayer(playerId); } removeGame(gameId: string): void { this.games.delete(gameId); } }