@gamepark/rules-api 6.18.0 → 6.20.0

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 (243) hide show
  1. package/dist/Action.d.ts +25 -25
  2. package/dist/Action.js +61 -61
  3. package/dist/Action.js.map +1 -1
  4. package/dist/ApplyAutomaticMoves.d.ts +2 -2
  5. package/dist/ApplyAutomaticMoves.js +24 -24
  6. package/dist/ApplyAutomaticMoves.js.map +1 -1
  7. package/dist/Competitive.d.ts +13 -13
  8. package/dist/Competitive.js +45 -45
  9. package/dist/Competitive.js.map +1 -1
  10. package/dist/DefaultGameSetup.d.ts +7 -7
  11. package/dist/DefaultGameSetup.js +14 -14
  12. package/dist/Dummy.d.ts +7 -7
  13. package/dist/Dummy.js +26 -26
  14. package/dist/Dummy.js.map +1 -1
  15. package/dist/Eliminations.d.ts +5 -5
  16. package/dist/Eliminations.js +8 -8
  17. package/dist/GameSetup.d.ts +3 -3
  18. package/dist/GameSetup.js +2 -2
  19. package/dist/GameSetupCreator.d.ts +4 -4
  20. package/dist/GameSetupCreator.js +2 -2
  21. package/dist/IncompleteInformation.d.ts +14 -14
  22. package/dist/IncompleteInformation.js +37 -37
  23. package/dist/IncompleteInformation.js.map +1 -1
  24. package/dist/LocalMovePreview.d.ts +4 -0
  25. package/dist/LocalMovePreview.js +8 -0
  26. package/dist/LocalMovePreview.js.map +1 -0
  27. package/dist/LoopWithFuse.d.ts +4 -4
  28. package/dist/LoopWithFuse.js +14 -14
  29. package/dist/LoopWithFuse.js.map +1 -1
  30. package/dist/RandomMove.d.ts +7 -7
  31. package/dist/RandomMove.js +14 -14
  32. package/dist/Robot.d.ts +1 -1
  33. package/dist/Robot.js +2 -2
  34. package/dist/Rules.d.ts +18 -17
  35. package/dist/Rules.js +78 -78
  36. package/dist/Rules.js.map +1 -1
  37. package/dist/RulesCreator.d.ts +7 -7
  38. package/dist/RulesCreator.js +2 -2
  39. package/dist/TimeLimit.d.ts +10 -10
  40. package/dist/TimeLimit.js +12 -12
  41. package/dist/TimeLimit.js.map +1 -1
  42. package/dist/Undo.d.ts +6 -6
  43. package/dist/Undo.js +8 -8
  44. package/dist/UnpredictableMove.d.ts +5 -5
  45. package/dist/UnpredictableMove.js +5 -5
  46. package/dist/index.d.ts +21 -20
  47. package/dist/index.js +37 -36
  48. package/dist/index.js.map +1 -1
  49. package/dist/material/HiddenMaterialRules.d.ts +36 -35
  50. package/dist/material/HiddenMaterialRules.js +245 -245
  51. package/dist/material/HiddenMaterialRules.js.map +1 -1
  52. package/dist/material/MaterialGame.d.ts +15 -15
  53. package/dist/material/MaterialGame.js +2 -2
  54. package/dist/material/MaterialGameSetup.d.ts +21 -21
  55. package/dist/material/MaterialGameSetup.js +75 -75
  56. package/dist/material/MaterialGameSetup.js.map +1 -1
  57. package/dist/material/MaterialRules.d.ts +44 -44
  58. package/dist/material/MaterialRules.js +242 -242
  59. package/dist/material/MaterialRules.js.map +1 -1
  60. package/dist/material/SecretMaterialRules.d.ts +13 -13
  61. package/dist/material/SecretMaterialRules.js +37 -37
  62. package/dist/material/index.d.ts +10 -10
  63. package/dist/material/index.js +26 -26
  64. package/dist/material/items/Material.d.ts +59 -57
  65. package/dist/material/items/Material.js +406 -376
  66. package/dist/material/items/Material.js.map +1 -1
  67. package/dist/material/items/MaterialItem.d.ts +7 -7
  68. package/dist/material/items/MaterialItem.js +2 -2
  69. package/dist/material/items/MaterialMutator.d.ts +31 -31
  70. package/dist/material/items/MaterialMutator.js +277 -272
  71. package/dist/material/items/MaterialMutator.js.map +1 -1
  72. package/dist/material/items/index.d.ts +3 -3
  73. package/dist/material/items/index.js +19 -19
  74. package/dist/material/location/Location.d.ts +11 -11
  75. package/dist/material/location/Location.js +2 -2
  76. package/dist/material/location/LocationBuilder.d.ts +12 -12
  77. package/dist/material/location/LocationBuilder.js +40 -40
  78. package/dist/material/location/index.d.ts +3 -3
  79. package/dist/material/location/index.js +19 -19
  80. package/dist/material/location/strategy/FillGapStrategy.d.ts +7 -7
  81. package/dist/material/location/strategy/FillGapStrategy.js +23 -23
  82. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
  83. package/dist/material/location/strategy/LocationStrategy.d.ts +6 -6
  84. package/dist/material/location/strategy/LocationStrategy.js +2 -2
  85. package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +9 -9
  86. package/dist/material/location/strategy/PositiveSequenceStrategy.js +65 -65
  87. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
  88. package/dist/material/location/strategy/index.d.ts +3 -3
  89. package/dist/material/location/strategy/index.js +19 -19
  90. package/dist/material/memory/GameMemory.d.ts +8 -8
  91. package/dist/material/memory/GameMemory.js +27 -27
  92. package/dist/material/memory/GameMemory.js.map +1 -1
  93. package/dist/material/memory/PlayerMemory.d.ts +9 -9
  94. package/dist/material/memory/PlayerMemory.js +32 -32
  95. package/dist/material/memory/PlayerMemory.js.map +1 -1
  96. package/dist/material/memory/index.d.ts +2 -2
  97. package/dist/material/memory/index.js +18 -18
  98. package/dist/material/moves/CustomMove.d.ts +9 -9
  99. package/dist/material/moves/CustomMove.js +10 -10
  100. package/dist/material/moves/MaterialMove.d.ts +7 -7
  101. package/dist/material/moves/MaterialMove.js +2 -2
  102. package/dist/material/moves/MoveKind.d.ts +6 -6
  103. package/dist/material/moves/MoveKind.js +10 -10
  104. package/dist/material/moves/MoveKind.js.map +1 -1
  105. package/dist/material/moves/index.d.ts +6 -6
  106. package/dist/material/moves/index.js +22 -22
  107. package/dist/material/moves/items/CreateItem.d.ts +10 -10
  108. package/dist/material/moves/items/CreateItem.js +15 -15
  109. package/dist/material/moves/items/CreateItemsAtOnce.d.ts +10 -10
  110. package/dist/material/moves/items/CreateItemsAtOnce.js +15 -15
  111. package/dist/material/moves/items/DeleteItem.d.ts +10 -10
  112. package/dist/material/moves/items/DeleteItem.js +15 -15
  113. package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +9 -9
  114. package/dist/material/moves/items/DeleteItemsAtOnce.js +15 -15
  115. package/dist/material/moves/items/ItemMove.d.ts +17 -17
  116. package/dist/material/moves/items/ItemMove.js +2 -2
  117. package/dist/material/moves/items/ItemMoveType.d.ts +11 -11
  118. package/dist/material/moves/items/ItemMoveType.js +15 -15
  119. package/dist/material/moves/items/ItemMoveType.js.map +1 -1
  120. package/dist/material/moves/items/ItemMovesBuilder.d.ts +8 -8
  121. package/dist/material/moves/items/ItemMovesBuilder.js +33 -33
  122. package/dist/material/moves/items/ItemMovesBuilder.js.map +1 -1
  123. package/dist/material/moves/items/MoveItem.d.ts +14 -14
  124. package/dist/material/moves/items/MoveItem.js +15 -15
  125. package/dist/material/moves/items/MoveItemsAtOnce.d.ts +13 -13
  126. package/dist/material/moves/items/MoveItemsAtOnce.js +15 -15
  127. package/dist/material/moves/items/RollItem.d.ts +11 -11
  128. package/dist/material/moves/items/RollItem.js +15 -15
  129. package/dist/material/moves/items/SelectItem.d.ts +11 -10
  130. package/dist/material/moves/items/SelectItem.js +15 -15
  131. package/dist/material/moves/items/SelectItem.js.map +1 -1
  132. package/dist/material/moves/items/Shuffle.d.ts +13 -13
  133. package/dist/material/moves/items/Shuffle.js +19 -19
  134. package/dist/material/moves/items/index.d.ts +12 -12
  135. package/dist/material/moves/items/index.js +28 -28
  136. package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -8
  137. package/dist/material/moves/local/CloseTutorialPopup.js +9 -9
  138. package/dist/material/moves/local/DisplayHelp.d.ts +39 -39
  139. package/dist/material/moves/local/DisplayHelp.js +29 -29
  140. package/dist/material/moves/local/DisplayHelp.js.map +1 -1
  141. package/dist/material/moves/local/DropItem.d.ts +13 -13
  142. package/dist/material/moves/local/DropItem.js +9 -9
  143. package/dist/material/moves/local/LocalMove.d.ts +12 -12
  144. package/dist/material/moves/local/LocalMove.js +11 -11
  145. package/dist/material/moves/local/LocalMove.js.map +1 -1
  146. package/dist/material/moves/local/SetTutorialStep.d.ts +9 -9
  147. package/dist/material/moves/local/SetTutorialStep.js +9 -9
  148. package/dist/material/moves/local/index.d.ts +5 -5
  149. package/dist/material/moves/local/index.js +21 -21
  150. package/dist/material/moves/rules/EndGame.d.ts +6 -6
  151. package/dist/material/moves/rules/EndGame.js +9 -9
  152. package/dist/material/moves/rules/EndPlayerTurn.d.ts +7 -7
  153. package/dist/material/moves/rules/EndPlayerTurn.js +9 -9
  154. package/dist/material/moves/rules/RuleMove.d.ts +18 -18
  155. package/dist/material/moves/rules/RuleMove.js +18 -18
  156. package/dist/material/moves/rules/RuleMove.js.map +1 -1
  157. package/dist/material/moves/rules/StartPlayerTurn.d.ts +8 -8
  158. package/dist/material/moves/rules/StartPlayerTurn.js +9 -9
  159. package/dist/material/moves/rules/StartRule.d.ts +7 -7
  160. package/dist/material/moves/rules/StartRule.js +9 -9
  161. package/dist/material/moves/rules/StartSimultaneousRule.d.ts +8 -8
  162. package/dist/material/moves/rules/StartSimultaneousRule.js +9 -9
  163. package/dist/material/moves/rules/index.d.ts +6 -6
  164. package/dist/material/moves/rules/index.js +22 -22
  165. package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +12 -12
  166. package/dist/material/rules/MaterialRulesMovesBuilder.js +35 -35
  167. package/dist/material/rules/MaterialRulesPart.d.ts +23 -23
  168. package/dist/material/rules/MaterialRulesPart.js +64 -64
  169. package/dist/material/rules/MaterialRulesPart.js.map +1 -1
  170. package/dist/material/rules/PlayerTurnRule.d.ts +9 -9
  171. package/dist/material/rules/PlayerTurnRule.js +52 -52
  172. package/dist/material/rules/RuleStep.d.ts +5 -5
  173. package/dist/material/rules/RuleStep.js +2 -2
  174. package/dist/material/rules/SimultaneousRule.d.ts +9 -9
  175. package/dist/material/rules/SimultaneousRule.js +41 -41
  176. package/dist/material/rules/SimultaneousRule.js.map +1 -1
  177. package/dist/material/rules/index.d.ts +5 -5
  178. package/dist/material/rules/index.js +21 -21
  179. package/dist/options/EnumOption.d.ts +6 -6
  180. package/dist/options/EnumOption.js +7 -7
  181. package/dist/options/Option.d.ts +8 -8
  182. package/dist/options/Option.js +2 -2
  183. package/dist/options/OptionSpecOf.d.ts +5 -5
  184. package/dist/options/OptionSpecOf.js +2 -2
  185. package/dist/options/OptionsSpec.d.ts +9 -9
  186. package/dist/options/OptionsSpec.js +2 -2
  187. package/dist/options/OptionsValidationError.d.ts +4 -4
  188. package/dist/options/OptionsValidationError.js +29 -29
  189. package/dist/options/OptionsValidationError.js.map +1 -1
  190. package/dist/options/PlayerEnumOption.d.ts +14 -14
  191. package/dist/options/PlayerEnumOption.js +66 -66
  192. package/dist/options/PlayerEnumOption.js.map +1 -1
  193. package/dist/options/PlayersOptionsSpec.d.ts +7 -7
  194. package/dist/options/PlayersOptionsSpec.js +2 -2
  195. package/dist/options/WithIdOption.d.ts +3 -3
  196. package/dist/options/WithIdOption.js +2 -2
  197. package/dist/options/WithPlayerOptionsSpec.d.ts +6 -6
  198. package/dist/options/WithPlayerOptionsSpec.js +7 -7
  199. package/dist/options/WithPlayersOptions.d.ts +3 -3
  200. package/dist/options/WithPlayersOptions.js +2 -2
  201. package/dist/options/index.d.ts +11 -11
  202. package/dist/options/index.js +27 -27
  203. package/dist/options/isWithPlayerIdOptions.d.ts +4 -4
  204. package/dist/options/isWithPlayerIdOptions.js +11 -11
  205. package/dist/utils/EnumUtils.d.ts +1 -1
  206. package/dist/utils/EnumUtils.js +7 -7
  207. package/dist/utils/grid.squares.util.d.ts +11 -11
  208. package/dist/utils/grid.squares.util.js +30 -30
  209. package/dist/utils/grid.squares.util.js.map +1 -1
  210. package/dist/utils/grid.util.d.ts +5 -5
  211. package/dist/utils/grid.util.js +7 -7
  212. package/dist/utils/index.d.ts +5 -5
  213. package/dist/utils/index.js +21 -21
  214. package/dist/utils/isDeadEndMove.util.d.ts +2 -2
  215. package/dist/utils/isDeadEndMove.util.js +18 -18
  216. package/dist/utils/listing.util.d.ts +2 -2
  217. package/dist/utils/listing.util.js +23 -23
  218. package/dist/utils/listing.util.js.map +1 -1
  219. package/package.json +34 -33
  220. package/dist/material/items/MaterialDeck.d.ts +0 -7
  221. package/dist/material/items/MaterialDeck.js +0 -35
  222. package/dist/material/items/MaterialDeck.js.map +0 -1
  223. package/dist/material/moves/items/MoveAtOnce.d.ts +0 -13
  224. package/dist/material/moves/items/MoveAtOnce.js +0 -16
  225. package/dist/material/moves/items/MoveAtOnce.js.map +0 -1
  226. package/dist/material/moves/items/Roll.d.ts +0 -11
  227. package/dist/material/moves/items/Roll.js +0 -16
  228. package/dist/material/moves/items/Roll.js.map +0 -1
  229. package/dist/material/moves/local/DisplayRules.d.ts +0 -32
  230. package/dist/material/moves/local/DisplayRules.js +0 -25
  231. package/dist/material/moves/local/DisplayRules.js.map +0 -1
  232. package/dist/material/moves/rules/StartSimultanousRule.d.ts +0 -10
  233. package/dist/material/moves/rules/StartSimultanousRule.js +0 -10
  234. package/dist/material/moves/rules/StartSimultanousRule.js.map +0 -1
  235. package/dist/options/PlayerIdSpec.d.ts +0 -7
  236. package/dist/options/PlayerIdSpec.js +0 -18
  237. package/dist/options/PlayerIdSpec.js.map +0 -1
  238. package/dist/options/getFallbackPlayerName.d.ts +0 -4
  239. package/dist/options/getFallbackPlayerName.js +0 -14
  240. package/dist/options/getFallbackPlayerName.js.map +0 -1
  241. package/dist/options/providePlayerIds.d.ts +0 -6
  242. package/dist/options/providePlayerIds.js +0 -36
  243. package/dist/options/providePlayerIds.js.map +0 -1
@@ -1,38 +1,38 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getMoveView = exports.getGameView = exports.hasSecretInformation = exports.hasIncompleteInformation = void 0;
4
- function hasIncompleteInformation(rules) {
5
- var test = rules;
6
- return typeof test.getView === 'function' && typeof test.getMoveView === 'function';
7
- }
8
- exports.hasIncompleteInformation = hasIncompleteInformation;
9
- function hasSecretInformation(rules) {
10
- var test = rules;
11
- return typeof test.getPlayerView === 'function';
12
- }
13
- exports.hasSecretInformation = hasSecretInformation;
14
- function getGameView(rules, playerId) {
15
- if (hasSecretInformation(rules) && playerId !== undefined) {
16
- return rules.getPlayerView(playerId);
17
- }
18
- else if (hasIncompleteInformation(rules)) {
19
- return rules.getView();
20
- }
21
- else {
22
- return rules.game;
23
- }
24
- }
25
- exports.getGameView = getGameView;
26
- function getMoveView(rules, move, playerId) {
27
- if (hasSecretInformation(rules) && rules.getPlayerMoveView && playerId !== undefined) {
28
- return JSON.parse(JSON.stringify(rules.getPlayerMoveView(move, playerId)));
29
- }
30
- else if (hasIncompleteInformation(rules)) {
31
- return JSON.parse(JSON.stringify(rules.getMoveView(move)));
32
- }
33
- else {
34
- return move;
35
- }
36
- }
37
- exports.getMoveView = getMoveView;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getMoveView = exports.getGameView = exports.hasSecretInformation = exports.hasIncompleteInformation = void 0;
4
+ function hasIncompleteInformation(rules) {
5
+ var test = rules;
6
+ return typeof test.getView === 'function' && typeof test.getMoveView === 'function';
7
+ }
8
+ exports.hasIncompleteInformation = hasIncompleteInformation;
9
+ function hasSecretInformation(rules) {
10
+ var test = rules;
11
+ return typeof test.getPlayerView === 'function';
12
+ }
13
+ exports.hasSecretInformation = hasSecretInformation;
14
+ function getGameView(rules, playerId) {
15
+ if (hasSecretInformation(rules) && playerId !== undefined) {
16
+ return rules.getPlayerView(playerId);
17
+ }
18
+ else if (hasIncompleteInformation(rules)) {
19
+ return rules.getView();
20
+ }
21
+ else {
22
+ return rules.game;
23
+ }
24
+ }
25
+ exports.getGameView = getGameView;
26
+ function getMoveView(rules, move, playerId) {
27
+ if (hasSecretInformation(rules) && rules.getPlayerMoveView && playerId !== undefined) {
28
+ return JSON.parse(JSON.stringify(rules.getPlayerMoveView(move, playerId)));
29
+ }
30
+ else if (hasIncompleteInformation(rules)) {
31
+ return JSON.parse(JSON.stringify(rules.getMoveView(move)));
32
+ }
33
+ else {
34
+ return move;
35
+ }
36
+ }
37
+ exports.getMoveView = getMoveView;
38
38
  //# sourceMappingURL=IncompleteInformation.js.map
@@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C;QACrE,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC5D,CAAC;SAAM,CAAC;QACN,OAAO,IAAuB,CAAA;IAChC,CAAC;AACH,CAAC;AARD,kCAQC"}
@@ -0,0 +1,4 @@
1
+ export interface LocalMovePreview<Move = any> {
2
+ previewMove(move: Move): boolean;
3
+ }
4
+ export declare function hasLocalMovePreview<Move = any>(rules: Object): rules is LocalMovePreview<Move>;
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasLocalMovePreview = void 0;
4
+ function hasLocalMovePreview(rules) {
5
+ return typeof rules.previewMove === 'function';
6
+ }
7
+ exports.hasLocalMovePreview = hasLocalMovePreview;
8
+ //# sourceMappingURL=LocalMovePreview.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"LocalMovePreview.js","sourceRoot":"","sources":["../src/LocalMovePreview.ts"],"names":[],"mappings":";;;AAIA,SAAgB,mBAAmB,CAAa,KAAa;IAC3D,OAAO,OAAQ,KAAgC,CAAC,WAAW,KAAK,UAAU,CAAA;AAC5E,CAAC;AAFD,kDAEC"}
@@ -1,4 +1,4 @@
1
- export declare function loopWithFuse(repeat: () => boolean, options?: {
2
- attempts?: number;
3
- errorFn?: () => Error;
4
- }): void;
1
+ export declare function loopWithFuse(repeat: () => boolean, options?: {
2
+ attempts?: number;
3
+ errorFn?: () => Error;
4
+ }): void;
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.loopWithFuse = void 0;
4
- function loopWithFuse(repeat, options) {
5
- var attempts = (options === null || options === void 0 ? void 0 : options.attempts) || (process.env.NODE_ENV === 'development' ? 1000 : 10000);
6
- var errorFn = (options === null || options === void 0 ? void 0 : options.errorFn) || (function () { return new Error('Infinite loop detected'); });
7
- while (repeat()) {
8
- if (attempts == 0) {
9
- throw errorFn();
10
- }
11
- attempts--;
12
- }
13
- }
14
- exports.loopWithFuse = loopWithFuse;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.loopWithFuse = void 0;
4
+ function loopWithFuse(repeat, options) {
5
+ var attempts = (options === null || options === void 0 ? void 0 : options.attempts) || (process.env.NODE_ENV === 'development' ? 1000 : 10000);
6
+ var errorFn = (options === null || options === void 0 ? void 0 : options.errorFn) || (function () { return new Error('Infinite loop detected'); });
7
+ while (repeat()) {
8
+ if (attempts == 0) {
9
+ throw errorFn();
10
+ }
11
+ attempts--;
12
+ }
13
+ }
14
+ exports.loopWithFuse = loopWithFuse;
15
15
  //# sourceMappingURL=LoopWithFuse.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LoopWithFuse.js","sourceRoot":"","sources":["../src/LoopWithFuse.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,MAAqB,EAAE,OAAsD;IACxG,IAAI,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC3F,IAAM,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,CAAC,cAAM,OAAA,IAAI,KAAK,CAAC,wBAAwB,CAAC,EAAnC,CAAmC,CAAC,CAAA;IAC/E,OAAO,MAAM,EAAE,EAAE;QACf,IAAI,QAAQ,IAAI,CAAC,EAAE;YACjB,MAAM,OAAO,EAAE,CAAA;SAChB;QACD,QAAQ,EAAE,CAAA;KACX;AACH,CAAC;AATD,oCASC"}
1
+ {"version":3,"file":"LoopWithFuse.js","sourceRoot":"","sources":["../src/LoopWithFuse.ts"],"names":[],"mappings":";;;AAAA,SAAgB,YAAY,CAAC,MAAqB,EAAE,OAAsD;IACxG,IAAI,QAAQ,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,QAAQ,KAAI,CAAC,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,aAAa,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;IAC3F,IAAM,OAAO,GAAG,CAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,KAAI,CAAC,cAAM,OAAA,IAAI,KAAK,CAAC,wBAAwB,CAAC,EAAnC,CAAmC,CAAC,CAAA;IAC/E,OAAO,MAAM,EAAE,EAAE,CAAC;QAChB,IAAI,QAAQ,IAAI,CAAC,EAAE,CAAC;YAClB,MAAM,OAAO,EAAE,CAAA;QACjB,CAAC;QACD,QAAQ,EAAE,CAAA;IACZ,CAAC;AACH,CAAC;AATD,oCASC"}
@@ -1,7 +1,7 @@
1
- import { Rules } from './Rules';
2
- export interface RandomMove<Move = any, RandomizedMove = any> {
3
- randomize(move: Move): Move & RandomizedMove;
4
- play(move: Move & RandomizedMove): Move[];
5
- }
6
- export declare function hasRandomMove<Game, Move, RandomizedMove>(rules: Rules<Game, Move>): rules is Rules<Game, Move> & RandomMove<Move, RandomizedMove>;
7
- export declare function randomizeMoves<Game, Move, RandomizedMove = Move>(rules: Rules<Game, Move>, moves: Move[]): (Move & RandomizedMove)[];
1
+ import { Rules } from './Rules';
2
+ export interface RandomMove<Move = any, RandomizedMove = any> {
3
+ randomize(move: Move): Move & RandomizedMove;
4
+ play(move: Move & RandomizedMove): Move[];
5
+ }
6
+ export declare function hasRandomMove<Game, Move, RandomizedMove>(rules: Rules<Game, Move>): rules is Rules<Game, Move> & RandomMove<Move, RandomizedMove>;
7
+ export declare function randomizeMoves<Game, Move, RandomizedMove = Move>(rules: Rules<Game, Move>, moves: Move[]): (Move & RandomizedMove)[];
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.randomizeMoves = exports.hasRandomMove = void 0;
4
- function hasRandomMove(rules) {
5
- var test = rules;
6
- return typeof test.randomize === "function";
7
- }
8
- exports.hasRandomMove = hasRandomMove;
9
- function randomizeMoves(rules, moves) {
10
- return hasRandomMove(rules)
11
- ? moves.map(function (move) { return rules.randomize(move); })
12
- : moves;
13
- }
14
- exports.randomizeMoves = randomizeMoves;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.randomizeMoves = exports.hasRandomMove = void 0;
4
+ function hasRandomMove(rules) {
5
+ var test = rules;
6
+ return typeof test.randomize === "function";
7
+ }
8
+ exports.hasRandomMove = hasRandomMove;
9
+ function randomizeMoves(rules, moves) {
10
+ return hasRandomMove(rules)
11
+ ? moves.map(function (move) { return rules.randomize(move); })
12
+ : moves;
13
+ }
14
+ exports.randomizeMoves = randomizeMoves;
15
15
  //# sourceMappingURL=RandomMove.js.map
package/dist/Robot.d.ts CHANGED
@@ -1 +1 @@
1
- export type Robot<Game, Move = string, PlayerId = number> = (state: Game, playerId: PlayerId) => Promise<Move[]>;
1
+ export type Robot<Game, Move = string, PlayerId = number> = (state: Game, playerId: PlayerId) => Promise<Move[]>;
package/dist/Robot.js CHANGED
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=Robot.js.map
package/dist/Rules.d.ts CHANGED
@@ -1,17 +1,18 @@
1
- export declare abstract class Rules<Game = any, Move = any, PlayerId = any> {
2
- game: Game;
3
- constructor(game: Game);
4
- get state(): Game;
5
- delegate(): Rules<Game, Move, PlayerId> | undefined;
6
- delegates(): Rules<Game, Move, PlayerId>[];
7
- isTurnToPlay(playerId: PlayerId): boolean;
8
- getActivePlayer(): PlayerId | undefined;
9
- isLegalMove(playerId: PlayerId, move: Move): boolean;
10
- getLegalMoves(playerId: PlayerId): Move[];
11
- getAutomaticMoves(): Move[];
12
- play(move: Move, context?: {
13
- local?: boolean;
14
- }): Move[];
15
- isOver(playerIds?: PlayerId[]): boolean;
16
- isUnpredictableMove?(move: Move, player: PlayerId): boolean;
17
- }
1
+ export declare abstract class Rules<Game = any, Move = any, PlayerId = any> {
2
+ game: Game;
3
+ constructor(game: Game);
4
+ get state(): Game;
5
+ delegate(): Rules<Game, Move, PlayerId> | undefined;
6
+ delegates(): Rules<Game, Move, PlayerId>[];
7
+ isTurnToPlay(playerId: PlayerId): boolean;
8
+ getActivePlayer(): PlayerId | undefined;
9
+ isLegalMove(playerId: PlayerId, move: Move): boolean;
10
+ getLegalMoves(playerId: PlayerId): Move[];
11
+ getAutomaticMoves(): Move[];
12
+ play(move: Move, context?: PlayMoveContext): Move[];
13
+ isOver(playerIds?: PlayerId[]): boolean;
14
+ isUnpredictableMove?(move: Move, player: PlayerId): boolean;
15
+ }
16
+ export type PlayMoveContext = {
17
+ local?: boolean;
18
+ };
package/dist/Rules.js CHANGED
@@ -1,79 +1,79 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Rules = void 0;
7
- var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
8
- var Eliminations_1 = require("./Eliminations");
9
- var Rules = (function () {
10
- function Rules(game) {
11
- this.game = game;
12
- }
13
- Object.defineProperty(Rules.prototype, "state", {
14
- get: function () {
15
- return this.game;
16
- },
17
- enumerable: false,
18
- configurable: true
19
- });
20
- Rules.prototype.delegate = function () {
21
- return;
22
- };
23
- Rules.prototype.delegates = function () {
24
- var delegate = this.delegate();
25
- return delegate ? [delegate] : [];
26
- };
27
- Rules.prototype.isTurnToPlay = function (playerId) {
28
- var rules = this.delegates();
29
- if (rules.some(function (rules) { return rules.isTurnToPlay(playerId); })) {
30
- return true;
31
- }
32
- return playerId === this.getActivePlayer();
33
- };
34
- Rules.prototype.getActivePlayer = function () {
35
- for (var _i = 0, _a = this.delegates(); _i < _a.length; _i++) {
36
- var delegate = _a[_i];
37
- var activePlayer = delegate.getActivePlayer();
38
- if (activePlayer !== undefined)
39
- return activePlayer;
40
- }
41
- return;
42
- };
43
- Rules.prototype.isLegalMove = function (playerId, move) {
44
- var rules = this.delegates();
45
- if (rules.some(function (rules) { return rules.isLegalMove(playerId, move); })) {
46
- return true;
47
- }
48
- if (this.getLegalMoves(playerId).some(function (legalMove) { return (0, fast_deep_equal_1.default)(move, legalMove); })) {
49
- return true;
50
- }
51
- if ((0, Eliminations_1.hasEliminations)(this) && this.giveUpMove) {
52
- return (0, fast_deep_equal_1.default)(move, this.giveUpMove(playerId));
53
- }
54
- return false;
55
- };
56
- Rules.prototype.getLegalMoves = function (playerId) {
57
- return this.delegates().flatMap(function (rules) { return rules.getLegalMoves(playerId); });
58
- };
59
- Rules.prototype.getAutomaticMoves = function () {
60
- return this.delegates().flatMap(function (rules) { return rules.getAutomaticMoves(); });
61
- };
62
- Rules.prototype.play = function (move, context) {
63
- return this.delegates().flatMap(function (rules) { return rules.play(move, context); });
64
- };
65
- Rules.prototype.isOver = function (playerIds) {
66
- var _this = this;
67
- var delegates = this.delegates();
68
- if (delegates.length > 0 && delegates.every(function (delegate) { return delegate.isOver(playerIds); })) {
69
- return true;
70
- }
71
- if (playerIds) {
72
- return !playerIds.some(function (playerId) { return _this.isTurnToPlay(playerId); });
73
- }
74
- return this.getActivePlayer() === undefined;
75
- };
76
- return Rules;
77
- }());
78
- exports.Rules = Rules;
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.Rules = void 0;
7
+ var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
8
+ var Eliminations_1 = require("./Eliminations");
9
+ var Rules = (function () {
10
+ function Rules(game) {
11
+ this.game = game;
12
+ }
13
+ Object.defineProperty(Rules.prototype, "state", {
14
+ get: function () {
15
+ return this.game;
16
+ },
17
+ enumerable: false,
18
+ configurable: true
19
+ });
20
+ Rules.prototype.delegate = function () {
21
+ return;
22
+ };
23
+ Rules.prototype.delegates = function () {
24
+ var delegate = this.delegate();
25
+ return delegate ? [delegate] : [];
26
+ };
27
+ Rules.prototype.isTurnToPlay = function (playerId) {
28
+ var rules = this.delegates();
29
+ if (rules.some(function (rules) { return rules.isTurnToPlay(playerId); })) {
30
+ return true;
31
+ }
32
+ return playerId === this.getActivePlayer();
33
+ };
34
+ Rules.prototype.getActivePlayer = function () {
35
+ for (var _i = 0, _a = this.delegates(); _i < _a.length; _i++) {
36
+ var delegate = _a[_i];
37
+ var activePlayer = delegate.getActivePlayer();
38
+ if (activePlayer !== undefined)
39
+ return activePlayer;
40
+ }
41
+ return;
42
+ };
43
+ Rules.prototype.isLegalMove = function (playerId, move) {
44
+ var rules = this.delegates();
45
+ if (rules.some(function (rules) { return rules.isLegalMove(playerId, move); })) {
46
+ return true;
47
+ }
48
+ if (this.getLegalMoves(playerId).some(function (legalMove) { return (0, fast_deep_equal_1.default)(move, legalMove); })) {
49
+ return true;
50
+ }
51
+ if ((0, Eliminations_1.hasEliminations)(this) && this.giveUpMove) {
52
+ return (0, fast_deep_equal_1.default)(move, this.giveUpMove(playerId));
53
+ }
54
+ return false;
55
+ };
56
+ Rules.prototype.getLegalMoves = function (playerId) {
57
+ return this.delegates().flatMap(function (rules) { return rules.getLegalMoves(playerId); });
58
+ };
59
+ Rules.prototype.getAutomaticMoves = function () {
60
+ return this.delegates().flatMap(function (rules) { return rules.getAutomaticMoves(); });
61
+ };
62
+ Rules.prototype.play = function (move, context) {
63
+ return this.delegates().flatMap(function (rules) { return rules.play(move, context); });
64
+ };
65
+ Rules.prototype.isOver = function (playerIds) {
66
+ var _this = this;
67
+ var delegates = this.delegates();
68
+ if (delegates.length > 0 && delegates.every(function (delegate) { return delegate.isOver(playerIds); })) {
69
+ return true;
70
+ }
71
+ if (playerIds) {
72
+ return !playerIds.some(function (playerId) { return _this.isTurnToPlay(playerId); });
73
+ }
74
+ return this.getActivePlayer() === undefined;
75
+ };
76
+ return Rules;
77
+ }());
78
+ exports.Rules = Rules;
79
79
  //# sourceMappingURL=Rules.js.map
package/dist/Rules.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Rules.js","sourceRoot":"","sources":["../src/Rules.ts"],"names":[],"mappings":";;;;;;AAAA,oEAAmC;AACnC,+CAAgD;AAEhD;IAGE,eAAY,IAAU;QACpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAA;IAClB,CAAC;IAED,sBAAI,wBAAK;aAAT;YACE,OAAO,IAAI,CAAC,IAAI,CAAA;QAClB,CAAC;;;OAAA;IAED,wBAAQ,GAAR;QACE,OAAM;IACR,CAAC;IAED,yBAAS,GAAT;QACE,IAAM,QAAQ,GAAG,IAAI,CAAC,QAAQ,EAAE,CAAA;QAChC,OAAO,QAAQ,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACnC,CAAC;IAED,4BAAY,GAAZ,UAAa,QAAkB;QAC7B,IAAM,KAAK,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAC9B,IAAI,KAAK,CAAC,IAAI,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,YAAY,CAAC,QAAQ,CAAC,EAA5B,CAA4B,CAAC,EAAE;YACrD,OAAO,IAAI,CAAA;SACZ;QACD,OAAO,QAAQ,KAAK,IAAI,CAAC,eAAe,EAAE,CAAA;IAC5C,CAAC;IAED,+BAAe,GAAf;QACE,KAAuB,UAAgB,EAAhB,KAAA,IAAI,CAAC,SAAS,EAAE,EAAhB,cAAgB,EAAhB,IAAgB,EAAE;YAApC,IAAM,QAAQ,SAAA;YACjB,IAAM,YAAY,GAAG,QAAQ,CAAC,eAAe,EAAE,CAAA;YAC/C,IAAI,YAAY,KAAK,SAAS;gBAAE,OAAO,YAAY,CAAA;SACpD;QACD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OAAA,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,EAA7B,CAA6B,CAAC,CAAA;IACzE,CAAC;IAED,iCAAiB,GAAjB;QACE,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,iBAAiB,EAAE,EAAzB,CAAyB,CAAC,CAAA;IACrE,CAAC;IAED,oBAAI,GAAJ,UAAK,IAAU,EAAE,OAAyB;QACxC,OAAO,IAAI,CAAC,SAAS,EAAE,CAAC,OAAO,CAAC,UAAA,KAAK,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,EAAE,OAAO,CAAC,EAAzB,CAAyB,CAAC,CAAA;IACrE,CAAC;IAED,sBAAM,GAAN,UAAO,SAAsB;QAA7B,iBASC;QARC,IAAM,SAAS,GAAG,IAAI,CAAC,SAAS,EAAE,CAAA;QAClC,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,SAAS,CAAC,KAAK,CAAC,UAAA,QAAQ,IAAI,OAAA,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,EAA1B,CAA0B,CAAC,EAAE,CAAC;YACpF,OAAO,IAAI,CAAA;QACb,CAAC;QACD,IAAI,SAAS,EAAE,CAAC;YACd,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,KAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAA3B,CAA2B,CAAC,CAAA;QACjE,CAAC;QACD,OAAO,IAAI,CAAC,eAAe,EAAE,KAAK,SAAS,CAAA;IAC7C,CAAC;IAGH,YAAC;AAAD,CAAC,AA1ED,IA0EC;AA1EqB,sBAAK"}
@@ -1,7 +1,7 @@
1
- import { Rules } from './Rules';
2
- export interface RulesCreator<Game = any, Move = any, Player = number, Options = any> {
3
- new (state: Game, client?: {
4
- player?: Player;
5
- }): Rules<Game, Move, Player>;
6
- new (options: Options): Rules<Game, Move, Player>;
7
- }
1
+ import { Rules } from './Rules';
2
+ export interface RulesCreator<Game = any, Move = any, Player = number, Options = any> {
3
+ new (state: Game, client?: {
4
+ player?: Player;
5
+ }): Rules<Game, Move, Player>;
6
+ new (options: Options): Rules<Game, Move, Player>;
7
+ }
@@ -1,3 +1,3 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  //# sourceMappingURL=RulesCreator.js.map
@@ -1,10 +1,10 @@
1
- import { Rules } from './Rules';
2
- export interface TimeLimit<Game, Move = string, PlayerId = number> extends Rules<Game, Move, PlayerId> {
3
- giveTime(playerId: PlayerId): number;
4
- startingTime?(playerId: PlayerId): number;
5
- }
6
- export declare function hasTimeLimit<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>): rules is TimeLimit<Game, Move, PlayerId>;
7
- export declare enum GameSpeed {
8
- Disabled = "Disabled",
9
- RealTime = "RealTime"
10
- }
1
+ import { Rules } from './Rules';
2
+ export interface TimeLimit<Game, Move = string, PlayerId = number> extends Rules<Game, Move, PlayerId> {
3
+ giveTime(playerId: PlayerId): number;
4
+ startingTime?(playerId: PlayerId): number;
5
+ }
6
+ export declare function hasTimeLimit<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>): rules is TimeLimit<Game, Move, PlayerId>;
7
+ export declare enum GameSpeed {
8
+ Disabled = "Disabled",
9
+ RealTime = "RealTime"
10
+ }
package/dist/TimeLimit.js CHANGED
@@ -1,13 +1,13 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.GameSpeed = exports.hasTimeLimit = void 0;
4
- function hasTimeLimit(rules) {
5
- return typeof rules.giveTime === 'function';
6
- }
7
- exports.hasTimeLimit = hasTimeLimit;
8
- var GameSpeed;
9
- (function (GameSpeed) {
10
- GameSpeed["Disabled"] = "Disabled";
11
- GameSpeed["RealTime"] = "RealTime";
12
- })(GameSpeed = exports.GameSpeed || (exports.GameSpeed = {}));
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.GameSpeed = exports.hasTimeLimit = void 0;
4
+ function hasTimeLimit(rules) {
5
+ return typeof rules.giveTime === 'function';
6
+ }
7
+ exports.hasTimeLimit = hasTimeLimit;
8
+ var GameSpeed;
9
+ (function (GameSpeed) {
10
+ GameSpeed["Disabled"] = "Disabled";
11
+ GameSpeed["RealTime"] = "RealTime";
12
+ })(GameSpeed || (exports.GameSpeed = GameSpeed = {}));
13
13
  //# sourceMappingURL=TimeLimit.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"TimeLimit.js","sourceRoot":"","sources":["../src/TimeLimit.ts"],"names":[],"mappings":";;;AAgBA,SAAgB,YAAY,CAAuB,KAAkC;IACnF,OAAO,OAAQ,KAAyC,CAAC,QAAQ,KAAK,UAAU,CAAA;AAClF,CAAC;AAFD,oCAEC;AAED,IAAY,SAAwD;AAApE,WAAY,SAAS;IAAE,kCAAqB,CAAA;IAAE,kCAAqB,CAAA;AAAA,CAAC,EAAxD,SAAS,GAAT,iBAAS,KAAT,iBAAS,QAA+C"}
1
+ {"version":3,"file":"TimeLimit.js","sourceRoot":"","sources":["../src/TimeLimit.ts"],"names":[],"mappings":";;;AAgBA,SAAgB,YAAY,CAAuB,KAAkC;IACnF,OAAO,OAAQ,KAAyC,CAAC,QAAQ,KAAK,UAAU,CAAA;AAClF,CAAC;AAFD,oCAEC;AAED,IAAY,SAAwD;AAApE,WAAY,SAAS;IAAE,kCAAqB,CAAA;IAAE,kCAAqB,CAAA;AAAA,CAAC,EAAxD,SAAS,yBAAT,SAAS,QAA+C"}
package/dist/Undo.d.ts CHANGED
@@ -1,6 +1,6 @@
1
- import { Action } from './Action';
2
- export interface Undo<Game, Move = string, PlayerId = number> {
3
- canUndo(action: Action<Move, PlayerId>, consecutiveActions: Action<Move, PlayerId>[]): boolean;
4
- restoreLocalMoves?(localState: Game): void;
5
- }
6
- export declare function hasUndo<Game, Move, PlayerId>(rules: Object): rules is Undo<Game, Move, PlayerId>;
1
+ import { Action } from './Action';
2
+ export interface Undo<Game, Move = string, PlayerId = number> {
3
+ canUndo(action: Action<Move, PlayerId>, consecutiveActions: Action<Move, PlayerId>[]): boolean;
4
+ restoreLocalMoves?(localState: Game): void;
5
+ }
6
+ export declare function hasUndo<Game, Move, PlayerId>(rules: Object): rules is Undo<Game, Move, PlayerId>;
package/dist/Undo.js CHANGED
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasUndo = void 0;
4
- function hasUndo(rules) {
5
- var test = rules;
6
- return typeof test.canUndo === 'function';
7
- }
8
- exports.hasUndo = hasUndo;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasUndo = void 0;
4
+ function hasUndo(rules) {
5
+ var test = rules;
6
+ return typeof test.canUndo === 'function';
7
+ }
8
+ exports.hasUndo = hasUndo;
9
9
  //# sourceMappingURL=Undo.js.map
@@ -1,5 +1,5 @@
1
- import { Rules } from './Rules';
2
- export type RulesWithUnpredictableMoves<G = any, M = any, P = any> = Rules<G, M, P> & {
3
- isUnpredictableMove(move: M): boolean;
4
- };
5
- export declare const hasUnpredictableMoves: <G = any, M = any, P = any>(rules: Rules<G, M, P>) => rules is RulesWithUnpredictableMoves<G, M, P>;
1
+ import { Rules } from './Rules';
2
+ export type RulesWithUnpredictableMoves<G = any, M = any, P = any> = Rules<G, M, P> & {
3
+ isUnpredictableMove(move: M): boolean;
4
+ };
5
+ export declare const hasUnpredictableMoves: <G = any, M = any, P = any>(rules: Rules<G, M, P>) => rules is RulesWithUnpredictableMoves<G, M, P>;
@@ -1,6 +1,6 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasUnpredictableMoves = void 0;
4
- var hasUnpredictableMoves = function (rules) { return typeof rules.isUnpredictableMove === 'function'; };
5
- exports.hasUnpredictableMoves = hasUnpredictableMoves;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasUnpredictableMoves = void 0;
4
+ var hasUnpredictableMoves = function (rules) { return typeof rules.isUnpredictableMove === 'function'; };
5
+ exports.hasUnpredictableMoves = hasUnpredictableMoves;
6
6
  //# sourceMappingURL=UnpredictableMove.js.map
package/dist/index.d.ts CHANGED
@@ -1,20 +1,21 @@
1
- export * from './material';
2
- export * from './options';
3
- export * from './utils';
4
- export * from './Action';
5
- export * from './ApplyAutomaticMoves';
6
- export * from './Competitive';
7
- export * from './DefaultGameSetup';
8
- export * from './Dummy';
9
- export * from './Eliminations';
10
- export * from './GameSetup';
11
- export * from './GameSetupCreator';
12
- export * from './IncompleteInformation';
13
- export * from './LoopWithFuse';
14
- export * from './RandomMove';
15
- export * from './Robot';
16
- export * from './Rules';
17
- export * from './RulesCreator';
18
- export * from './TimeLimit';
19
- export * from './Undo';
20
- export * from './UnpredictableMove';
1
+ export * from './material';
2
+ export * from './options';
3
+ export * from './utils';
4
+ export * from './Action';
5
+ export * from './ApplyAutomaticMoves';
6
+ export * from './Competitive';
7
+ export * from './DefaultGameSetup';
8
+ export * from './Dummy';
9
+ export * from './Eliminations';
10
+ export * from './GameSetup';
11
+ export * from './GameSetupCreator';
12
+ export * from './IncompleteInformation';
13
+ export * from './LocalMovePreview';
14
+ export * from './LoopWithFuse';
15
+ export * from './RandomMove';
16
+ export * from './Robot';
17
+ export * from './Rules';
18
+ export * from './RulesCreator';
19
+ export * from './TimeLimit';
20
+ export * from './Undo';
21
+ export * from './UnpredictableMove';