本文整理汇总了TypeScript中BoardComponents/Board.Board类的典型用法代码示例。如果您正苦于以下问题:TypeScript Board类的具体用法?TypeScript Board怎么用?TypeScript Board使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Board类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: clone
private static clone(source: Board): Board {
var clone = new Board();
let layout = new Array<number[]>();
for (let pointId = 0; pointId < 26; pointId++) {
layout[pointId] = [source.checkerContainers[pointId].checkers[PlayerId.BLACK], source.checkerContainers[pointId].checkers[PlayerId.RED]]
}
clone.initialise(layout);
return clone;
}
示例2: constructor
constructor(containerId: string, blackIsComputer = false, redIsComputer = false) {
let board = new Board();
let dice = new Dice(new DiceRollGenerator());
let statusLogger = new StatusLogger();
let game = new Game(board, dice, statusLogger, [blackIsComputer, redIsComputer]);
let ui = new GameUI(containerId, game);
board.initialise();
// TODO: UI trigger game to begin
dice.rollToStart(statusLogger, (successfulPlayer: PlayerId) => {
game.begin(successfulPlayer);
});
}
示例3: canMove
private static canMove(board: Board, playerId: PlayerId, points: number): boolean {
// 25: include bar
for (let startingPoint = 1; startingPoint <= 25; startingPoint++) {
if (board.isLegalMove(new Move(playerId, startingPoint, points))) {
return true;
}
}
return false;
}
示例4:
pointUI.onSelected = () => { board.onPointSelected(pointId); };