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


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

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


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

示例1:

// $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 });

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

// $ExpectType string[]
chess.moves({ square: "e2" });

// $ExpectType string[]
chess.moves({});
开发者ID:AlexGalays,项目名称:DefinitelyTyped,代码行数:31,代码来源:chess.js-tests.ts


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