@gamepark/rules-api 7.0.0-beta.0 → 7.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (249) hide show
  1. package/dist/Action.js +1 -2
  2. package/dist/Bot.js +15 -37
  3. package/dist/Bot.js.map +1 -1
  4. package/dist/Competitive.js +3 -8
  5. package/dist/Competitive.js.map +1 -1
  6. package/dist/Eliminations.js +2 -5
  7. package/dist/Eliminations.js.map +1 -1
  8. package/dist/GameSetup.js +1 -2
  9. package/dist/HiddenInformation.js +2 -5
  10. package/dist/HiddenInformation.js.map +1 -1
  11. package/dist/LocalMovePreview.js +1 -4
  12. package/dist/LocalMovePreview.js.map +1 -1
  13. package/dist/RandomMove.js +1 -2
  14. package/dist/Rules.js +49 -56
  15. package/dist/Rules.js.map +1 -1
  16. package/dist/SecretInformation.js +2 -5
  17. package/dist/SecretInformation.js.map +1 -1
  18. package/dist/TimeLimit.js +1 -4
  19. package/dist/TimeLimit.js.map +1 -1
  20. package/dist/Undo.js +2 -5
  21. package/dist/Undo.js.map +1 -1
  22. package/dist/UnpredictableMove.js +1 -5
  23. package/dist/UnpredictableMove.js.map +1 -1
  24. package/dist/index.js +16 -32
  25. package/dist/index.js.map +1 -1
  26. package/dist/material/HiddenMaterialRules.js +125 -180
  27. package/dist/material/HiddenMaterialRules.js.map +1 -1
  28. package/dist/material/MaterialGame.js +1 -2
  29. package/dist/material/MaterialGameSetup.js +52 -70
  30. package/dist/material/MaterialGameSetup.js.map +1 -1
  31. package/dist/material/MaterialRules.js +186 -250
  32. package/dist/material/MaterialRules.js.map +1 -1
  33. package/dist/material/SecretMaterialRules.js +9 -35
  34. package/dist/material/SecretMaterialRules.js.map +1 -1
  35. package/dist/material/index.js +11 -27
  36. package/dist/material/index.js.map +1 -1
  37. package/dist/material/items/Material.js +177 -262
  38. package/dist/material/items/Material.js.map +1 -1
  39. package/dist/material/items/MaterialDeck.js +10 -36
  40. package/dist/material/items/MaterialDeck.js.map +1 -1
  41. package/dist/material/items/MaterialItem.js +1 -2
  42. package/dist/material/items/MaterialMoney.js +89 -141
  43. package/dist/material/items/MaterialMoney.js.map +1 -1
  44. package/dist/material/items/MaterialMutator.js +108 -145
  45. package/dist/material/items/MaterialMutator.js.map +1 -1
  46. package/dist/material/items/index.js +5 -21
  47. package/dist/material/items/index.js.map +1 -1
  48. package/dist/material/location/Location.js +1 -14
  49. package/dist/material/location/Location.js.map +1 -1
  50. package/dist/material/location/LocationBuilder.js +26 -41
  51. package/dist/material/location/LocationBuilder.js.map +1 -1
  52. package/dist/material/location/index.js +3 -19
  53. package/dist/material/location/index.js.map +1 -1
  54. package/dist/material/location/strategy/FillGapStrategy.js +9 -16
  55. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
  56. package/dist/material/location/strategy/LocationStrategy.js +1 -2
  57. package/dist/material/location/strategy/PositiveSequenceStrategy.js +26 -35
  58. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
  59. package/dist/material/location/strategy/StackingStrategy.js +15 -22
  60. package/dist/material/location/strategy/StackingStrategy.js.map +1 -1
  61. package/dist/material/location/strategy/index.js +5 -23
  62. package/dist/material/location/strategy/index.js.map +1 -1
  63. package/dist/material/memory/GameMemory.js +10 -14
  64. package/dist/material/memory/GameMemory.js.map +1 -1
  65. package/dist/material/memory/PlayerMemory.js +13 -18
  66. package/dist/material/memory/PlayerMemory.js.map +1 -1
  67. package/dist/material/memory/index.js +2 -18
  68. package/dist/material/memory/index.js.map +1 -1
  69. package/dist/material/moves/CustomMove.js +4 -9
  70. package/dist/material/moves/CustomMove.js.map +1 -1
  71. package/dist/material/moves/MaterialMove.js +1 -2
  72. package/dist/material/moves/MaterialMoveBuilder.js +16 -32
  73. package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
  74. package/dist/material/moves/MoveKind.js +2 -5
  75. package/dist/material/moves/MoveKind.js.map +1 -1
  76. package/dist/material/moves/index.js +7 -23
  77. package/dist/material/moves/index.js.map +1 -1
  78. package/dist/material/moves/items/CreateItem.js +6 -12
  79. package/dist/material/moves/items/CreateItem.js.map +1 -1
  80. package/dist/material/moves/items/CreateItemsAtOnce.js +6 -12
  81. package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
  82. package/dist/material/moves/items/DeleteItem.js +6 -12
  83. package/dist/material/moves/items/DeleteItem.js.map +1 -1
  84. package/dist/material/moves/items/DeleteItemsAtOnce.js +6 -12
  85. package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
  86. package/dist/material/moves/items/ItemMove.js +1 -2
  87. package/dist/material/moves/items/ItemMoveType.js +2 -5
  88. package/dist/material/moves/items/ItemMoveType.js.map +1 -1
  89. package/dist/material/moves/items/MoveItem.js +6 -12
  90. package/dist/material/moves/items/MoveItem.js.map +1 -1
  91. package/dist/material/moves/items/MoveItemsAtOnce.js +6 -12
  92. package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
  93. package/dist/material/moves/items/RollItem.js +6 -12
  94. package/dist/material/moves/items/RollItem.js.map +1 -1
  95. package/dist/material/moves/items/SelectItem.js +6 -12
  96. package/dist/material/moves/items/SelectItem.js.map +1 -1
  97. package/dist/material/moves/items/Shuffle.js +7 -14
  98. package/dist/material/moves/items/Shuffle.js.map +1 -1
  99. package/dist/material/moves/items/index.js +11 -27
  100. package/dist/material/moves/items/index.js.map +1 -1
  101. package/dist/material/moves/local/CloseTutorialPopup.js +4 -7
  102. package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
  103. package/dist/material/moves/local/DisplayHelp.js +2 -5
  104. package/dist/material/moves/local/DisplayHelp.js.map +1 -1
  105. package/dist/material/moves/local/DropItem.js +1 -2
  106. package/dist/material/moves/local/LocalMove.js +2 -5
  107. package/dist/material/moves/local/LocalMove.js.map +1 -1
  108. package/dist/material/moves/local/SetTutorialStep.js +4 -7
  109. package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
  110. package/dist/material/moves/local/index.js +5 -21
  111. package/dist/material/moves/local/index.js.map +1 -1
  112. package/dist/material/moves/rules/EndGame.js +4 -7
  113. package/dist/material/moves/rules/EndGame.js.map +1 -1
  114. package/dist/material/moves/rules/EndPlayerTurn.js +4 -7
  115. package/dist/material/moves/rules/EndPlayerTurn.js.map +1 -1
  116. package/dist/material/moves/rules/RuleMove.js +3 -7
  117. package/dist/material/moves/rules/RuleMove.js.map +1 -1
  118. package/dist/material/moves/rules/StartPlayerTurn.js +4 -7
  119. package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -1
  120. package/dist/material/moves/rules/StartRule.js +4 -7
  121. package/dist/material/moves/rules/StartRule.js.map +1 -1
  122. package/dist/material/moves/rules/StartSimultaneousRule.js +4 -7
  123. package/dist/material/moves/rules/StartSimultaneousRule.js.map +1 -1
  124. package/dist/material/moves/rules/index.js +6 -22
  125. package/dist/material/moves/rules/index.js.map +1 -1
  126. package/dist/material/rules/MaterialRulesPart.js +38 -63
  127. package/dist/material/rules/MaterialRulesPart.js.map +1 -1
  128. package/dist/material/rules/PlayerTurnRule.js +20 -52
  129. package/dist/material/rules/PlayerTurnRule.js.map +1 -1
  130. package/dist/material/rules/RuleStep.js +1 -2
  131. package/dist/material/rules/SimultaneousRule.js +19 -51
  132. package/dist/material/rules/SimultaneousRule.js.map +1 -1
  133. package/dist/material/rules/index.js +4 -20
  134. package/dist/material/rules/index.js.map +1 -1
  135. package/dist/material/tutorial/TutorialState.js +1 -2
  136. package/dist/material/tutorial/index.js +1 -17
  137. package/dist/material/tutorial/index.js.map +1 -1
  138. package/dist/options/EnumArrayOption.js +3 -6
  139. package/dist/options/EnumArrayOption.js.map +1 -1
  140. package/dist/options/EnumOption.js +1 -4
  141. package/dist/options/EnumOption.js.map +1 -1
  142. package/dist/options/Option.js +1 -2
  143. package/dist/options/OptionSpecOf.js +1 -2
  144. package/dist/options/OptionsSpec.js +1 -2
  145. package/dist/options/OptionsValidationError.js +6 -28
  146. package/dist/options/OptionsValidationError.js.map +1 -1
  147. package/dist/options/PlayerEnumOption.js +19 -29
  148. package/dist/options/PlayerEnumOption.js.map +1 -1
  149. package/dist/options/PlayersOptionsSpec.js +1 -2
  150. package/dist/options/WithIdOption.js +1 -2
  151. package/dist/options/WithPlayerOptionsSpec.js +1 -4
  152. package/dist/options/WithPlayerOptionsSpec.js.map +1 -1
  153. package/dist/options/WithPlayersOptions.js +1 -2
  154. package/dist/options/index.js +12 -28
  155. package/dist/options/index.js.map +1 -1
  156. package/dist/options/isWithPlayerIdOptions.js +3 -6
  157. package/dist/options/isWithPlayerIdOptions.js.map +1 -1
  158. package/dist/utils/action-view.util.js +18 -25
  159. package/dist/utils/action-view.util.js.map +1 -1
  160. package/dist/utils/action.util.js +11 -16
  161. package/dist/utils/action.util.js.map +1 -1
  162. package/dist/utils/adjacent-groups.util.js +33 -41
  163. package/dist/utils/adjacent-groups.util.js.map +1 -1
  164. package/dist/utils/automatic-moves.util.js +10 -15
  165. package/dist/utils/automatic-moves.util.js.map +1 -1
  166. package/dist/utils/enum.util.js +7 -13
  167. package/dist/utils/enum.util.js.map +1 -1
  168. package/dist/utils/game-view.util.js +5 -8
  169. package/dist/utils/game-view.util.js.map +1 -1
  170. package/dist/utils/grid.hex.util.js +36 -88
  171. package/dist/utils/grid.hex.util.js.map +1 -1
  172. package/dist/utils/grid.squares.util.js +8 -19
  173. package/dist/utils/grid.squares.util.js.map +1 -1
  174. package/dist/utils/grid.util.js +1 -5
  175. package/dist/utils/grid.util.js.map +1 -1
  176. package/dist/utils/index.js +16 -32
  177. package/dist/utils/index.js.map +1 -1
  178. package/dist/utils/listing.util.js +8 -13
  179. package/dist/utils/listing.util.js.map +1 -1
  180. package/dist/utils/loops.util.js +3 -6
  181. package/dist/utils/loops.util.js.map +1 -1
  182. package/dist/utils/money.util.js +54 -73
  183. package/dist/utils/money.util.js.map +1 -1
  184. package/dist/utils/neighbors.util.js +6 -10
  185. package/dist/utils/neighbors.util.js.map +1 -1
  186. package/dist/utils/polyhex.util.js +36 -56
  187. package/dist/utils/polyhex.util.js.map +1 -1
  188. package/dist/utils/random.util.js +2 -5
  189. package/dist/utils/random.util.js.map +1 -1
  190. package/dist/utils/rank.util.js +9 -13
  191. package/dist/utils/rank.util.js.map +1 -1
  192. package/package.json +43 -37
  193. package/dist/ApplyAutomaticMoves.d.ts +0 -2
  194. package/dist/ApplyAutomaticMoves.js +0 -25
  195. package/dist/ApplyAutomaticMoves.js.map +0 -1
  196. package/dist/DefaultGameSetup.d.ts +0 -7
  197. package/dist/DefaultGameSetup.js +0 -15
  198. package/dist/DefaultGameSetup.js.map +0 -1
  199. package/dist/Dummy.d.ts +0 -7
  200. package/dist/Dummy.js +0 -27
  201. package/dist/Dummy.js.map +0 -1
  202. package/dist/GameSetupCreator.d.ts +0 -4
  203. package/dist/GameSetupCreator.js +0 -3
  204. package/dist/GameSetupCreator.js.map +0 -1
  205. package/dist/IncompleteInformation.d.ts +0 -14
  206. package/dist/IncompleteInformation.js +0 -38
  207. package/dist/IncompleteInformation.js.map +0 -1
  208. package/dist/LoopWithFuse.d.ts +0 -4
  209. package/dist/LoopWithFuse.js +0 -15
  210. package/dist/LoopWithFuse.js.map +0 -1
  211. package/dist/Robot.d.ts +0 -1
  212. package/dist/Robot.js +0 -3
  213. package/dist/Robot.js.map +0 -1
  214. package/dist/RulesCreator.d.ts +0 -7
  215. package/dist/RulesCreator.js +0 -3
  216. package/dist/RulesCreator.js.map +0 -1
  217. package/dist/material/location/strategy/StakingStrategy.d.ts +0 -12
  218. package/dist/material/location/strategy/StakingStrategy.js +0 -32
  219. package/dist/material/location/strategy/StakingStrategy.js.map +0 -1
  220. package/dist/material/moves/items/ItemMovesBuilder.d.ts +0 -8
  221. package/dist/material/moves/items/ItemMovesBuilder.js +0 -34
  222. package/dist/material/moves/items/ItemMovesBuilder.js.map +0 -1
  223. package/dist/material/rules/MaterialMoveBuilder.d.ts +0 -9
  224. package/dist/material/rules/MaterialMoveBuilder.js +0 -28
  225. package/dist/material/rules/MaterialMoveBuilder.js.map +0 -1
  226. package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +0 -12
  227. package/dist/material/rules/MaterialRulesMovesBuilder.js +0 -36
  228. package/dist/material/rules/MaterialRulesMovesBuilder.js.map +0 -1
  229. package/dist/setup/DefaultGameSetup.d.ts +0 -7
  230. package/dist/setup/DefaultGameSetup.js +0 -15
  231. package/dist/setup/DefaultGameSetup.js.map +0 -1
  232. package/dist/setup/GameSetup.d.ts +0 -3
  233. package/dist/setup/GameSetup.js +0 -3
  234. package/dist/setup/GameSetup.js.map +0 -1
  235. package/dist/setup/GameSetupCreator.d.ts +0 -4
  236. package/dist/setup/GameSetupCreator.js +0 -3
  237. package/dist/setup/GameSetupCreator.js.map +0 -1
  238. package/dist/setup/index.d.ts +0 -2
  239. package/dist/setup/index.js +0 -19
  240. package/dist/setup/index.js.map +0 -1
  241. package/dist/utils/EnumUtils.d.ts +0 -1
  242. package/dist/utils/EnumUtils.js +0 -8
  243. package/dist/utils/EnumUtils.js.map +0 -1
  244. package/dist/utils/coordinates.util.d.ts +0 -5
  245. package/dist/utils/coordinates.util.js +0 -16
  246. package/dist/utils/coordinates.util.js.map +0 -1
  247. package/dist/utils/isDeadEndMove.util.d.ts +0 -2
  248. package/dist/utils/isDeadEndMove.util.js +0 -19
  249. package/dist/utils/isDeadEndMove.util.js.map +0 -1
package/dist/Action.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=Action.js.map
package/dist/Bot.js CHANGED
@@ -1,46 +1,26 @@
1
- "use strict";
2
- var __extends = (this && this.__extends) || (function () {
3
- var extendStatics = function (d, b) {
4
- extendStatics = Object.setPrototypeOf ||
5
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
6
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
7
- return extendStatics(d, b);
8
- };
9
- return function (d, b) {
10
- if (typeof b !== "function" && b !== null)
11
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
12
- extendStatics(d, b);
13
- function __() { this.constructor = d; }
14
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
15
- };
16
- })();
17
- Object.defineProperty(exports, "__esModule", { value: true });
18
- exports.RandomBot = exports.Bot = void 0;
19
1
  /**
20
2
  * A Bot is a player controlled by a machine for a game.
21
3
  * Used to replace players that quit a game, or for opponents in tutorials.
22
4
  * Could be used to create AI players.
23
5
  */
24
- var Bot = /** @class */ (function () {
25
- function Bot(player) {
6
+ export class Bot {
7
+ player;
8
+ constructor(player) {
26
9
  this.player = player;
27
10
  }
28
- return Bot;
29
- }());
30
- exports.Bot = Bot;
11
+ }
31
12
  /**
32
13
  * A random bot picks a random move to play amongst all the legal moves.
33
14
  * Most board games can list efficiently all the legal moves all the time, which allows to have random bot to replace any missing opponent.
34
15
  */
35
- var RandomBot = /** @class */ (function (_super) {
36
- __extends(RandomBot, _super);
37
- function RandomBot(Rules, player) {
38
- var _this = _super.call(this, player) || this;
39
- _this.Rules = Rules;
40
- return _this;
16
+ export class RandomBot extends Bot {
17
+ Rules;
18
+ constructor(Rules, player) {
19
+ super(player);
20
+ this.Rules = Rules;
41
21
  }
42
- RandomBot.prototype.run = function (game) {
43
- var moves = this.getLegalMoves(game);
22
+ run(game) {
23
+ const moves = this.getLegalMoves(game);
44
24
  switch (moves.length) {
45
25
  case 0:
46
26
  console.warn('Random bot requires at least one legal move from getLegalMoves to run');
@@ -50,7 +30,7 @@ var RandomBot = /** @class */ (function (_super) {
50
30
  default:
51
31
  return [moves[Math.floor(Math.random() * moves.length)]];
52
32
  }
53
- };
33
+ }
54
34
  /**
55
35
  * The legal moves for this player at this game state.
56
36
  * Can be overridden if you need to further restrict the moves you want the bot to play.
@@ -58,10 +38,8 @@ var RandomBot = /** @class */ (function (_super) {
58
38
  * @param game The game state
59
39
  * @protected
60
40
  */
61
- RandomBot.prototype.getLegalMoves = function (game) {
41
+ getLegalMoves(game) {
62
42
  return new this.Rules(game).getLegalMoves(this.player);
63
- };
64
- return RandomBot;
65
- }(Bot));
66
- exports.RandomBot = RandomBot;
43
+ }
44
+ }
67
45
  //# sourceMappingURL=Bot.js.map
package/dist/Bot.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Bot.js","sourceRoot":"","sources":["../src/Bot.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAEA;;;;GAIG;AACH;IACE,aAAgC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAC9C,CAAC;IAQH,UAAC;AAAD,CAAC,AAVD,IAUC;AAVqB,kBAAG;AAYzB;;;GAGG;AACH;IAAqE,6BAAG;IACtE,mBAAoB,KAAuC,EAAE,MAAc;QACzE,YAAA,MAAK,YAAC,MAAM,CAAC,SAAA;QADK,WAAK,GAAL,KAAK,CAAkC;;IAE3D,CAAC;IAED,uBAAG,GAAH,UAAI,IAAU;QACZ,IAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QACtC,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAA;gBACrF,OAAO,EAAE,CAAA;YACX,KAAK,CAAC;gBACJ,OAAO,KAAK,CAAA;YACd;gBACE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACO,iCAAa,GAAvB,UAAwB,IAAU;QAChC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxD,CAAC;IACH,gBAAC;AAAD,CAAC,AA5BD,CAAqE,GAAG,GA4BvE;AA5BY,8BAAS"}
1
+ {"version":3,"file":"Bot.js","sourceRoot":"","sources":["../src/Bot.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAgB,GAAG;IACS;IAAhC,YAAgC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAC9C,CAAC;CAQF;AAED;;;GAGG;AACH,MAAM,OAAO,SAAgD,SAAQ,GAAG;IAClD;IAApB,YAAoB,KAAuC,EAAE,MAAc;QACzE,KAAK,CAAC,MAAM,CAAC,CAAA;QADK,UAAK,GAAL,KAAK,CAAkC;IAE3D,CAAC;IAED,GAAG,CAAC,IAAU;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QACtC,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAA;gBACrF,OAAO,EAAE,CAAA;YACX,KAAK,CAAC;gBACJ,OAAO,KAAK,CAAA;YACd;gBACE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACO,aAAa,CAAC,IAAU;QAChC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxD,CAAC;CACF"}
@@ -1,14 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isCompetitive = isCompetitive;
4
- exports.isCompetitiveScore = isCompetitiveScore;
5
- exports.isCompetitiveRank = isCompetitiveRank;
6
1
  /**
7
2
  * Type guard to identify if a game's Rule is Competitive or not.
8
3
  * @param rules game's Rule
9
4
  * @returns true if the game is competitive
10
5
  */
11
- function isCompetitive(rules) {
6
+ export function isCompetitive(rules) {
12
7
  return isCompetitiveScore(rules) || isCompetitiveRank(rules);
13
8
  }
14
9
  /**
@@ -16,7 +11,7 @@ function isCompetitive(rules) {
16
11
  * @param rules game's Rule
17
12
  * @returns true if the game is competitive with scores
18
13
  */
19
- function isCompetitiveScore(rules) {
14
+ export function isCompetitiveScore(rules) {
20
15
  return typeof rules.getScore === 'function';
21
16
  }
22
17
  /**
@@ -24,7 +19,7 @@ function isCompetitiveScore(rules) {
24
19
  * @param rules game's Rule
25
20
  * @returns true if the game is competitive with ranking (used when scores are not available)
26
21
  */
27
- function isCompetitiveRank(rules) {
22
+ export function isCompetitiveRank(rules) {
28
23
  return typeof rules.rankPlayers === 'function';
29
24
  }
30
25
  //# sourceMappingURL=Competitive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Competitive.js","sourceRoot":"","sources":["../src/Competitive.ts"],"names":[],"mappings":";;AAmDA,sCAEC;AAOD,gDAEC;AAOD,8CAEC;AAzBD;;;;GAIG;AACH,SAAgB,aAAa,CAAuB,KAAgC;IAClF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAC9D,CAAC;AAED;;;;GAIG;AACH,SAAgB,kBAAkB,CAAuB,KAAgC;IACvF,OAAO,OAAQ,KAAgD,CAAC,QAAQ,KAAK,UAAU,CAAA;AACzF,CAAC;AAED;;;;GAIG;AACH,SAAgB,iBAAiB,CAAuB,KAAgC;IACtF,OAAO,OAAQ,KAA+C,CAAC,WAAW,KAAK,UAAU,CAAA;AAC3F,CAAC"}
1
+ {"version":3,"file":"Competitive.js","sourceRoot":"","sources":["../src/Competitive.ts"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAuB,KAAgC;IAClF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAuB,KAAgC;IACvF,OAAO,OAAQ,KAAgD,CAAC,QAAQ,KAAK,UAAU,CAAA;AACzF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAuB,KAAgC;IACtF,OAAO,OAAQ,KAA+C,CAAC,WAAW,KAAK,UAAU,CAAA;AAC3F,CAAC"}
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasEliminations = hasEliminations;
4
1
  /**
5
2
  * Type guard for {@link Eliminations} interface
6
3
  * @param rules Rules of a game
7
4
  * @returns true if the Rules implements {@link Eliminations}
8
5
  */
9
- function hasEliminations(rules) {
10
- var test = rules;
6
+ export function hasEliminations(rules) {
7
+ const test = rules;
11
8
  return typeof test.isEliminated === 'function';
12
9
  }
13
10
  //# sourceMappingURL=Eliminations.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Eliminations.js","sourceRoot":"","sources":["../src/Eliminations.ts"],"names":[],"mappings":";;AAuBA,0CAGC;AARD;;;;GAIG;AACH,SAAgB,eAAe,CAAiB,KAAa;IAC3D,IAAM,IAAI,GAAG,KAAqC,CAAA;IAClD,OAAO,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAA;AAChD,CAAC"}
1
+ {"version":3,"file":"Eliminations.js","sourceRoot":"","sources":["../src/Eliminations.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAiB,KAAa;IAC3D,MAAM,IAAI,GAAG,KAAqC,CAAA;IAClD,OAAO,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAA;AAChD,CAAC"}
package/dist/GameSetup.js CHANGED
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=GameSetup.js.map
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasHiddenInformation = hasHiddenInformation;
4
1
  /**
5
2
  * Type guard for games with hidden information
6
3
  * @param rules Rules of the game
7
4
  * @returns true if the game implements {@link HiddenInformation}
8
5
  */
9
- function hasHiddenInformation(rules) {
10
- var test = rules;
6
+ export function hasHiddenInformation(rules) {
7
+ const test = rules;
11
8
  return typeof test.getView === 'function' && typeof test.getMoveView === 'function';
12
9
  }
13
10
  //# sourceMappingURL=HiddenInformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"HiddenInformation.js","sourceRoot":"","sources":["../src/HiddenInformation.ts"],"names":[],"mappings":";;AA4BA,oDAGC;AARD;;;;GAIG;AACH,SAAgB,oBAAoB,CAA6C,KAAa;IAC5F,IAAM,IAAI,GAAG,KAAoD,CAAA;IACjE,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAA;AACrF,CAAC"}
1
+ {"version":3,"file":"HiddenInformation.js","sourceRoot":"","sources":["../src/HiddenInformation.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAA6C,KAAa;IAC5F,MAAM,IAAI,GAAG,KAAoD,CAAA;IACjE,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAA;AACrF,CAAC"}
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasLocalMovePreview = hasLocalMovePreview;
4
1
  /**
5
2
  * Type guard for {@link LocalMovePreview} interface
6
3
  * @param rules The game's rules
7
4
  * @return true if the rules implements {@link LocalMovePreview}
8
5
  */
9
- function hasLocalMovePreview(rules) {
6
+ export function hasLocalMovePreview(rules) {
10
7
  return typeof rules.previewMove === 'function';
11
8
  }
12
9
  //# sourceMappingURL=LocalMovePreview.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LocalMovePreview.js","sourceRoot":"","sources":["../src/LocalMovePreview.ts"],"names":[],"mappings":";;AAkBA,kDAEC;AAPD;;;;GAIG;AACH,SAAgB,mBAAmB,CAAa,KAAa;IAC3D,OAAO,OAAQ,KAAgC,CAAC,WAAW,KAAK,UAAU,CAAA;AAC5E,CAAC"}
1
+ {"version":3,"file":"LocalMovePreview.js","sourceRoot":"","sources":["../src/LocalMovePreview.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAa,KAAa;IAC3D,OAAO,OAAQ,KAAgC,CAAC,WAAW,KAAK,UAAU,CAAA;AAC5E,CAAC"}
@@ -1,3 +1,2 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ export {};
3
2
  //# sourceMappingURL=RandomMove.js.map
package/dist/Rules.js CHANGED
@@ -1,8 +1,5 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Rules = void 0;
4
- var es_toolkit_1 = require("es-toolkit");
5
- var Eliminations_1 = require("./Eliminations");
1
+ import { isEqual } from 'es-toolkit';
2
+ import { hasEliminations } from './Eliminations';
6
3
  /**
7
4
  * The Rules class is the basic minimal API to implement when adapting a board game on Game Park.
8
5
  * It has the ability to tell whether it is a player's turn to play, what moves are legal, what happens when a move is played, and when the game is over.
@@ -11,33 +8,33 @@ var Eliminations_1 = require("./Eliminations");
11
8
  * @typeparam Move - Data structure of a game move
12
9
  * @typeparam PlayerId - type of the player's identifiers. Usually a number or a numeric enum.
13
10
  */
14
- var Rules = /** @class */ (function () {
11
+ export class Rules {
12
+ /**
13
+ * The state of the game
14
+ */
15
+ game;
15
16
  /**
16
17
  * Construct a new instance of the Rules to work on a game state
17
18
  * @param game the state of the game to work on
18
19
  */
19
- function Rules(game) {
20
+ constructor(game) {
20
21
  this.game = game;
21
22
  }
22
- Object.defineProperty(Rules.prototype, "state", {
23
- /**
24
- * A shortcut for this.game for backward compatibility
25
- */
26
- get: function () {
27
- return this.game;
28
- },
29
- enumerable: false,
30
- configurable: true
31
- });
23
+ /**
24
+ * A shortcut for this.game for backward compatibility
25
+ */
26
+ get state() {
27
+ return this.game;
28
+ }
32
29
  /**
33
30
  * The delegation allows to split the rules in smaller and simpler parts.
34
31
  * Override this method to delegate the behavior of the other method to another Rules class.
35
32
  *
36
33
  * @return the Rule you want to delegate the current game behavior to
37
34
  */
38
- Rules.prototype.delegate = function () {
35
+ delegate() {
39
36
  return;
40
- };
37
+ }
41
38
  /**
42
39
  * The delegation allows to split the rules in smaller and simpler parts.
43
40
  * Default behavior call {@link delegate} and returns either an empty array, or an array with the delegate if any.
@@ -45,10 +42,10 @@ var Rules = /** @class */ (function () {
45
42
  *
46
43
  * @return an array of Rules to delegate the current game behavior to
47
44
  */
48
- Rules.prototype.delegates = function () {
49
- var delegate = this.delegate();
45
+ delegates() {
46
+ const delegate = this.delegate();
50
47
  return delegate ? [delegate] : [];
51
- };
48
+ }
52
49
  /**
53
50
  * Implement this to tell at any point in the game which player is active or not.
54
51
  * When it's a player's turn, his thinking time decreases.
@@ -58,28 +55,27 @@ var Rules = /** @class */ (function () {
58
55
  * @param playerId - Identifier of a player
59
56
  * @returns true if it is this player's turn to play
60
57
  */
61
- Rules.prototype.isTurnToPlay = function (playerId) {
62
- var rules = this.delegates();
63
- if (rules.some(function (rules) { return rules.isTurnToPlay(playerId); })) {
58
+ isTurnToPlay(playerId) {
59
+ const rules = this.delegates();
60
+ if (rules.some(rules => rules.isTurnToPlay(playerId))) {
64
61
  return true;
65
62
  }
66
63
  return playerId === this.getActivePlayer();
67
- };
64
+ }
68
65
  /**
69
66
  * When only one player is active at a time, you can implement this method instead of "isTurnToPlay" to tell which player is active.
70
67
  * Supports delegation: if any {@link delegates} returns an active player, it will return it.
71
68
  *
72
69
  * @return @typeParam PlayerId - The identifier of the active player
73
70
  */
74
- Rules.prototype.getActivePlayer = function () {
75
- for (var _i = 0, _a = this.delegates(); _i < _a.length; _i++) {
76
- var delegate = _a[_i];
77
- var activePlayer = delegate.getActivePlayer();
71
+ getActivePlayer() {
72
+ for (const delegate of this.delegates()) {
73
+ const activePlayer = delegate.getActivePlayer();
78
74
  if (activePlayer !== undefined)
79
75
  return activePlayer;
80
76
  }
81
77
  return;
82
- };
78
+ }
83
79
  /**
84
80
  * This method allows the Game Park server to authorise only valid moves in accordance with the game rules.
85
81
  * The default behavior calls {@link getLegalMoves}, and returns true when at least one move is equal.
@@ -89,19 +85,19 @@ var Rules = /** @class */ (function () {
89
85
  * @param move - a Move to control
90
86
  * @returns true if the move can be played by this player
91
87
  */
92
- Rules.prototype.isLegalMove = function (playerId, move) {
93
- var rules = this.delegates();
94
- if (rules.some(function (rules) { return rules.isLegalMove(playerId, move); })) {
88
+ isLegalMove(playerId, move) {
89
+ const rules = this.delegates();
90
+ if (rules.some(rules => rules.isLegalMove(playerId, move))) {
95
91
  return true;
96
92
  }
97
- if (this.getLegalMoves(playerId).some(function (legalMove) { return (0, es_toolkit_1.isEqual)(move, legalMove); })) {
93
+ if (this.getLegalMoves(playerId).some(legalMove => isEqual(move, legalMove))) {
98
94
  return true;
99
95
  }
100
- if ((0, Eliminations_1.hasEliminations)(this) && this.giveUpMove) {
101
- return (0, es_toolkit_1.isEqual)(move, this.giveUpMove(playerId));
96
+ if (hasEliminations(this) && this.giveUpMove) {
97
+ return isEqual(move, this.giveUpMove(playerId));
102
98
  }
103
99
  return false;
104
- };
100
+ }
105
101
  /**
106
102
  * This method lists all the moves that are legal for a given player.
107
103
  * This is optional but convenient: it is used by {@link isLegalMove}, {@link Bot} and many UI features from @gamepark/react-game to automatically
@@ -114,9 +110,9 @@ var Rules = /** @class */ (function () {
114
110
  * @param playerId - Identifier of a player
115
111
  * @returns the list of the moves
116
112
  */
117
- Rules.prototype.getLegalMoves = function (playerId) {
118
- return this.delegates().flatMap(function (rules) { return rules.getLegalMoves(playerId); });
119
- };
113
+ getLegalMoves(playerId) {
114
+ return this.delegates().flatMap(rules => rules.getLegalMoves(playerId));
115
+ }
120
116
  /**
121
117
  * When some game state require automatic actions to be taken by the players, you can return a list of moves to play played automatically.
122
118
  * It can be a sequences in the rules where everything is scripted for instance (no choices left for players).
@@ -125,9 +121,9 @@ var Rules = /** @class */ (function () {
125
121
  *
126
122
  * @returns the list of the moves that must be played automatically
127
123
  */
128
- Rules.prototype.getAutomaticMoves = function () {
129
- return this.delegates().flatMap(function (rules) { return rules.getAutomaticMoves(); });
130
- };
124
+ getAutomaticMoves() {
125
+ return this.delegates().flatMap(rules => rules.getAutomaticMoves());
126
+ }
131
127
  /**
132
128
  * Executes a move on current game state.
133
129
  * This method is the only one that should mutate the state of the game.
@@ -145,9 +141,9 @@ var Rules = /** @class */ (function () {
145
141
  * @param context - context of execution: see {@link PlayMoveContext}
146
142
  * @returns A list of moves that should be immediately played as consequences of this move
147
143
  */
148
- Rules.prototype.play = function (move, context) {
149
- return this.delegates().flatMap(function (rules) { return rules.play(move, context); });
150
- };
144
+ play(move, context) {
145
+ return this.delegates().flatMap(rules => rules.play(move, context));
146
+ }
151
147
  /**
152
148
  * This method must return true when the game is over.
153
149
  *
@@ -157,18 +153,15 @@ var Rules = /** @class */ (function () {
157
153
  * @param playerIds - All the player ids in the game. Do not use (deprecated).
158
154
  * @returns true if game is over
159
155
  */
160
- Rules.prototype.isOver = function (playerIds) {
161
- var _this = this;
162
- var delegates = this.delegates();
163
- if (delegates.length > 0 && delegates.every(function (delegate) { return delegate.isOver(playerIds); })) {
156
+ isOver(playerIds) {
157
+ const delegates = this.delegates();
158
+ if (delegates.length > 0 && delegates.every(delegate => delegate.isOver(playerIds))) {
164
159
  return true;
165
160
  }
166
161
  if (playerIds) {
167
- return !playerIds.some(function (playerId) { return _this.isTurnToPlay(playerId); });
162
+ return !playerIds.some(playerId => this.isTurnToPlay(playerId));
168
163
  }
169
164
  return this.getActivePlayer() === undefined;
170
- };
171
- return Rules;
172
- }());
173
- exports.Rules = Rules;
165
+ }
166
+ }
174
167
  //# sourceMappingURL=Rules.js.map
package/dist/Rules.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.js","sourceRoot":"","sources":["../src/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AAK,CAAA;IACd,CAAC;IAGD;;;;;;;;;;;OAWG;IACH,aAAa,CAAC,QAAkB;QAC9B,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,CAAA;IACzE,CAAC;IAED;;;;;;;OAOG;IACH,iBAAiB;QACf,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,CAAC,CAAA;IACrE,CAAC;IAED;;;;;;;;;;;;;;;;OAgBG;IACH,IAAI,CAAC,IAAU,EAAE,OAAyB;QACxC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC,CAAA;IACrE,CAAC;IAED;;;;;;;;OAQG;IACH,MAAM,CAAC,SAAsB;QAC3B,MAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAClC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC;YACpF,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,EAAE,KAAK,SAAS,CAAA;IAC7C,CAAC;CAYF"}
@@ -1,13 +1,10 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasSecretInformation = hasSecretInformation;
4
1
  /**
5
2
  * Type guard for games with secret information
6
3
  * @param rules Rules of the game
7
4
  * @returns true if the game implements {@link SecretInformation}
8
5
  */
9
- function hasSecretInformation(rules) {
10
- var test = rules;
6
+ export function hasSecretInformation(rules) {
7
+ const test = rules;
11
8
  return typeof test.getPlayerView === 'function';
12
9
  }
13
10
  //# sourceMappingURL=SecretInformation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"SecretInformation.js","sourceRoot":"","sources":["../src/SecretInformation.ts"],"names":[],"mappings":";;AAiEA,oDAGC;AARD;;;;GAIG;AACH,SAAgB,oBAAoB,CAA6D,KAAa;IAC5G,IAAM,IAAI,GAAG,KAA8D,CAAA;IAC3E,OAAO,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;AACjD,CAAC"}
1
+ {"version":3,"file":"SecretInformation.js","sourceRoot":"","sources":["../src/SecretInformation.ts"],"names":[],"mappings":"AA4DA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAA6D,KAAa;IAC5G,MAAM,IAAI,GAAG,KAA8D,CAAA;IAC3E,OAAO,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;AACjD,CAAC"}
package/dist/TimeLimit.js CHANGED
@@ -1,12 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasTimeLimit = hasTimeLimit;
4
1
  /**
5
2
  * Type guard for {@link TimeLimit} interface
6
3
  * @param rules Rules of the game
7
4
  * @returns true if rules implements {@link TimeLimit}
8
5
  */
9
- function hasTimeLimit(rules) {
6
+ export function hasTimeLimit(rules) {
10
7
  return typeof rules.giveTime === 'function';
11
8
  }
12
9
  //# sourceMappingURL=TimeLimit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeLimit.js","sourceRoot":"","sources":["../src/TimeLimit.ts"],"names":[],"mappings":";;AA8BA,oCAEC;AAPD;;;;GAIG;AACH,SAAgB,YAAY,CAAuB,KAAkC;IACnF,OAAO,OAAQ,KAAyC,CAAC,QAAQ,KAAK,UAAU,CAAA;AAClF,CAAC"}
1
+ {"version":3,"file":"TimeLimit.js","sourceRoot":"","sources":["../src/TimeLimit.ts"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAuB,KAAkC;IACnF,OAAO,OAAQ,KAAyC,CAAC,QAAQ,KAAK,UAAU,CAAA;AAClF,CAAC"}
package/dist/Undo.js CHANGED
@@ -1,14 +1,11 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasUndo = hasUndo;
4
1
  /**
5
2
  * Type guard to know if a game implements the Undo feature.
6
3
  *
7
4
  * @param rules Rules of the game
8
5
  * @returns true if rules implements {@link Undo}
9
6
  */
10
- function hasUndo(rules) {
11
- var test = rules;
7
+ export function hasUndo(rules) {
8
+ const test = rules;
12
9
  return typeof test.canUndo === 'function';
13
10
  }
14
11
  //# sourceMappingURL=Undo.js.map
package/dist/Undo.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Undo.js","sourceRoot":"","sources":["../src/Undo.ts"],"names":[],"mappings":";;AAgCA,0BAGC;AATD;;;;;GAKG;AACH,SAAgB,OAAO,CAAuB,KAAa;IACzD,IAAM,IAAI,GAAG,KAAmC,CAAA;IAChD,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAA;AAC3C,CAAC"}
1
+ {"version":3,"file":"Undo.js","sourceRoot":"","sources":["../src/Undo.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAuB,KAAa;IACzD,MAAM,IAAI,GAAG,KAAmC,CAAA;IAChD,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAA;AAC3C,CAAC"}
@@ -1,11 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasUnpredictableMoves = void 0;
4
1
  /**
5
2
  * Type guard for {@link UnpredictableMoves} interface
6
3
  * @param rules Rules of the game
7
4
  * @returns true is rules implements {@link UnpredictableMoves}
8
5
  */
9
- var hasUnpredictableMoves = function (rules) { return typeof rules.isUnpredictableMove === 'function'; };
10
- exports.hasUnpredictableMoves = hasUnpredictableMoves;
6
+ export const hasUnpredictableMoves = (rules) => typeof rules.isUnpredictableMove === 'function';
11
7
  //# sourceMappingURL=UnpredictableMove.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"UnpredictableMove.js","sourceRoot":"","sources":["../src/UnpredictableMove.ts"],"names":[],"mappings":";;;AAsBA;;;;GAIG;AACI,IAAM,qBAAqB,GAAG,UACnC,KAAqB,IACkC,OAAA,OAAO,KAAK,CAAC,mBAAmB,KAAK,UAAU,EAA/C,CAA+C,CAAA;AAF3F,QAAA,qBAAqB,yBAEsE"}
1
+ {"version":3,"file":"UnpredictableMove.js","sourceRoot":"","sources":["../src/UnpredictableMove.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAqB,EAC+B,EAAE,CAAC,OAAO,KAAK,CAAC,mBAAmB,KAAK,UAAU,CAAA"}
package/dist/index.js CHANGED
@@ -1,33 +1,17 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
- for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
- };
16
- Object.defineProperty(exports, "__esModule", { value: true });
17
- __exportStar(require("./material"), exports);
18
- __exportStar(require("./options"), exports);
19
- __exportStar(require("./utils"), exports);
20
- __exportStar(require("./Action"), exports);
21
- __exportStar(require("./Bot"), exports);
22
- __exportStar(require("./Competitive"), exports);
23
- __exportStar(require("./Eliminations"), exports);
24
- __exportStar(require("./GameSetup"), exports);
25
- __exportStar(require("./HiddenInformation"), exports);
26
- __exportStar(require("./LocalMovePreview"), exports);
27
- __exportStar(require("./RandomMove"), exports);
28
- __exportStar(require("./Rules"), exports);
29
- __exportStar(require("./SecretInformation"), exports);
30
- __exportStar(require("./TimeLimit"), exports);
31
- __exportStar(require("./Undo"), exports);
32
- __exportStar(require("./UnpredictableMove"), exports);
1
+ export * from './material';
2
+ export * from './options';
3
+ export * from './utils';
4
+ export * from './Action';
5
+ export * from './Bot';
6
+ export * from './Competitive';
7
+ export * from './Eliminations';
8
+ export * from './GameSetup';
9
+ export * from './HiddenInformation';
10
+ export * from './LocalMovePreview';
11
+ export * from './RandomMove';
12
+ export * from './Rules';
13
+ export * from './SecretInformation';
14
+ export * from './TimeLimit';
15
+ export * from './Undo';
16
+ export * from './UnpredictableMove';
33
17
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,6CAA0B;AAC1B,4CAAyB;AACzB,0CAAuB;AACvB,2CAAwB;AACxB,wCAAqB;AACrB,gDAA6B;AAC7B,iDAA8B;AAC9B,8CAA2B;AAC3B,sDAAmC;AACnC,qDAAkC;AAClC,+CAA4B;AAC5B,0CAAuB;AACvB,sDAAmC;AACnC,8CAA2B;AAC3B,yCAAsB;AACtB,sDAAmC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,qBAAqB,CAAA"}