UNPKG

backgammon

Version:

a clean api for building a backgammon game

26 lines (25 loc) 910 B
import { MovePath } from "./modules/Board"; import { Player, Players } from "./modules/Player"; import { Dices, SingleDice } from "./modules/Dice"; import { Point } from "./modules/Point"; interface Turn { dices: Dices; player: Player; possibleMoves: MovePath[]; } export declare class Board { points: Point[]; players: Players; currentTurn: Turn; constructor(); submitMove(submittedMove: MovePath[]): void; private generateNextMove; PlayerInPrison(player?: Player): boolean; currentPlayerCanBearOff(): boolean; getPlayersPoints(player?: Player): Point[]; score(player: Player): number; getTargetPoint(point: Point, dice: SingleDice, player: Player): Point | undefined; getMovePathsForPoint(point: Point, dices: Dices, player: Player): MovePath[]; getAllMovePaths(dices: Dices, player?: Player): MovePath[]; } export {};