当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript Board.Board类代码示例

本文整理汇总了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;
 }
开发者ID:timiles,项目名称:backgammon,代码行数:9,代码来源:BoardAnalyser.ts

示例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);
        });
    }
开发者ID:timiles,项目名称:backgammon,代码行数:15,代码来源:Backgammon.ts

示例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;
 }
开发者ID:timiles,项目名称:backgammon,代码行数:9,代码来源:BoardAnalyser.ts

示例4:

 pointUI.onSelected = () => { board.onPointSelected(pointId); };
开发者ID:timiles,项目名称:backgammon,代码行数:1,代码来源:EventBinders.ts


注:本文中的BoardComponents/Board.Board类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。