You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

24 lines
935 B

import { chess } from './chess.mjs';
import { checkers } from './checkers.mjs';
import { parchis } from './parchis-classic.mjs';
import { parchis as legacyParchis } from './parchis.mjs';
import { go } from './go.mjs';
import { oca } from './oca.mjs';
// Trusted modules are deployed with the application. No uploaded code is executed.
export const games = new Map(
[chess, checkers, parchis, go, oca].map((game) => [game.id, game]),
);
export { catalog } from '../../shared/catalog.mjs';
export function getGame(id, version) {
// Existing checkers positions use the same state and receive the requested fix.
if (id === 'damas' && version === '1.0.0') return checkers;
if (id === 'parchis' && version === legacyParchis.version)
return legacyParchis;
const game = games.get(id);
if (!game || (version && game.version !== version))
throw new Error('La versión de este juego no está disponible.');
return game;
}

Powered by TurnKey Linux.