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


TypeScript js.Chess.reset方法代码示例

本文整理汇总了TypeScript中chess.js.Chess.reset方法的典型用法代码示例。如果您正苦于以下问题:TypeScript js.Chess.reset方法的具体用法?TypeScript js.Chess.reset怎么用?TypeScript js.Chess.reset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在chess.js.Chess的用法示例。


在下文中一共展示了js.Chess.reset方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: constructor

 /**
  * Creates an instance of PgnGame. Is constructed normally be the PgnReader.
  * @param config a hash with all parameters given
  * @memberOf PGN
  * 
  */
 constructor(pgnMoves: PgnMove[], startPosition: string, result: string, pgnString: string) {
     this.chess = new Chess()
     this.pgnString = pgnString
     this.pgnMoves = pgnMoves
     this.result = result
     if (pgnString !== undefined) {
         this.pgnString = pgnString
     }
     if ( (startPosition === undefined) || (startPosition === null) ) {
         this.chess.reset()
         this.startPosition = this.chess.fen()
     } else {
         this.startPosition = startPosition
         this.chess.load(this.startPosition)
     }
 }
开发者ID:mliebelt,项目名称:PgnViewerTS,代码行数:22,代码来源:Game.ts

示例2:

// $ExpectType "q"
chess.QUEEN;

// $ExpectType "k"
chess.KING;

// tslint:disable-next-line:max-line-length
// $ExpectType ["a8", "b8", "c8", "d8", "e8", "f8", "g8", "h8", "a7", "b7", "c7", "d7", "e7", "f7", "g7", "h7", "a6", "b6", "c6", "d6", "e6", "f6", "g6", "h6", "a5", "b5", "c5", "d5", "e5", "f5", "g5", "h5", "a4", "b4", "c4", "d4", "e4", "f4", "g4", "h4", "a3", "b3", "c3", "d3", "e3", "f3", "g3", "h3", "a2", "b2", "c2", "d2", "e2", "f2", "g2", "h2", "a1", "b1", "c1", "d1", "e1", "f1", "g1", "h1"]
chess.SQUARES;

// $ExpectType { NORMAL: "n"; CAPTURE: "c"; BIG_PAWN: "b"; EP_CAPTURE: "e"; PROMOTION: "p"; KSIDE_CASTLE: "k"; QSIDE_CASTLE: "q"; }
chess.FLAGS;

// $ExpectType void
chess.reset();

// $ExpectType boolean
chess.load(fen);

// -- moves -- \\

// $ExpectType Move[]
chess.moves({ verbose: true });

// $ExpectType string[]
chess.moves({ verbose: false });

// $ExpectType Move[]
chess.moves({ square: "e2", verbose: true });
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:29,代码来源:chess.js-tests.ts

示例3: defaultStartPosition

 private defaultStartPosition() {
     this.chess.reset()
     return this.chess.fen()
 }
开发者ID:mliebelt,项目名称:PgnViewerTS,代码行数:4,代码来源:reader.ts


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