Files
duplicate_chess/src/engine/boards.ts
T
2026-05-19 00:43:23 -04:00

33 lines
976 B
TypeScript

import type { BoardId, Player, Color } from './types';
export const BOARD_IDS: BoardId[] = ['NW', 'NE', 'SW', 'SE'];
/** Turn order. */
export const PLAYERS: Player[] = ['N', 'S', 'E', 'W'];
/** The two boards each player controls (order is stable: [boardA, boardB]). */
export const PLAYER_BOARDS: Record<Player, [BoardId, BoardId]> = {
N: ['NW', 'NE'],
S: ['SW', 'SE'],
E: ['NE', 'SE'],
W: ['NW', 'SW'],
};
/** The colour each player plays on both their boards. */
export const PLAYER_COLOR: Record<Player, Color> = {
N: 'w', S: 'w', E: 'b', W: 'b',
};
/** The white and black player of each board. */
export const BOARD_PLAYERS: Record<BoardId, { w: Player; b: Player }> = {
NW: { w: 'N', b: 'W' },
NE: { w: 'N', b: 'E' },
SW: { w: 'S', b: 'W' },
SE: { w: 'S', b: 'E' },
};
/** Compass rotation in degrees for rendering each board (see spec §5.1). */
export const BOARD_ROTATION: Record<BoardId, number> = {
NW: 225, NE: 135, SW: 315, SE: 45,
};