@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,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEnumOption = void 0;
4
- function isEnumOption(option) {
5
- return Array.isArray(option.values);
6
- }
7
- exports.isEnumOption = isEnumOption;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEnumOption = void 0;
4
+ function isEnumOption(option) {
5
+ return Array.isArray(option.values);
6
+ }
7
+ exports.isEnumOption = isEnumOption;
8
8
  //# sourceMappingURL=EnumOption.js.map
@@ -1,8 +1,8 @@
1
- import { TFunction } from 'i18next';
2
- export type Option = {
3
- label: (t: TFunction) => string;
4
- help?: (t: TFunction) => string;
5
- warn?: (t: TFunction) => string;
6
- subscriberRequired?: boolean;
7
- competitiveDisabled?: boolean;
8
- };
1
+ import { TFunction } from 'i18next';
2
+ export type Option = {
3
+ label: (t: TFunction) => string;
4
+ help?: (t: TFunction) => string;
5
+ warn?: (t: TFunction) => string;
6
+ subscriberRequired?: boolean;
7
+ competitiveDisabled?: boolean;
8
+ };
@@ -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=Option.js.map
@@ -1,5 +1,5 @@
1
- import { EnumOption } from './EnumOption';
2
- import { Option } from './Option';
3
- import { PlayerEnumOption } from './PlayerEnumOption';
4
- export type OptionSpecOf<T> = [T] extends [boolean] ? Option : EnumOption<T>;
5
- export type PlayerOptionSpecOf<T> = [T] extends [boolean] ? Option : PlayerEnumOption<T>;
1
+ import { EnumOption } from './EnumOption';
2
+ import { Option } from './Option';
3
+ import { PlayerEnumOption } from './PlayerEnumOption';
4
+ export type OptionSpecOf<T> = [T] extends [boolean] ? Option : EnumOption<T>;
5
+ export type PlayerOptionSpecOf<T> = [T] extends [boolean] ? Option : PlayerEnumOption<T>;
@@ -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=OptionSpecOf.js.map
@@ -1,9 +1,9 @@
1
- import { TFunction } from 'i18next';
2
- import { OptionSpecOf } from './OptionSpecOf';
3
- import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
- import { WithPlayersOptions } from './WithPlayersOptions';
5
- export type OptionsSpec<Options> = (Options extends WithPlayersOptions<infer P> ? WithPlayerOptionsSpec<P> : {}) & {
6
- [key in keyof Omit<Options, 'players'>]: OptionSpecOf<Options[key]>;
7
- } & {
8
- validate?: (options: Partial<Options>, t: TFunction) => void;
9
- };
1
+ import { TFunction } from 'i18next';
2
+ import { OptionSpecOf } from './OptionSpecOf';
3
+ import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
+ import { WithPlayersOptions } from './WithPlayersOptions';
5
+ export type OptionsSpec<Options> = (Options extends WithPlayersOptions<infer P> ? WithPlayerOptionsSpec<P> : {}) & {
6
+ [key in keyof Omit<Options, 'players'>]: OptionSpecOf<Options[key]>;
7
+ } & {
8
+ validate?: (options: Partial<Options>, t: TFunction) => void;
9
+ };
@@ -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=OptionsSpec.js.map
@@ -1,4 +1,4 @@
1
- export declare class OptionsValidationError extends Error {
2
- fields: string[];
3
- constructor(message: string, fields?: string[]);
4
- }
1
+ export declare class OptionsValidationError extends Error {
2
+ fields: string[];
3
+ constructor(message: string, fields?: string[]);
4
+ }
@@ -1,30 +1,30 @@
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.OptionsValidationError = void 0;
19
- var OptionsValidationError = (function (_super) {
20
- __extends(OptionsValidationError, _super);
21
- function OptionsValidationError(message, fields) {
22
- if (fields === void 0) { fields = []; }
23
- var _this = _super.call(this, message) || this;
24
- _this.fields = fields;
25
- return _this;
26
- }
27
- return OptionsValidationError;
28
- }(Error));
29
- exports.OptionsValidationError = OptionsValidationError;
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.OptionsValidationError = void 0;
19
+ var OptionsValidationError = (function (_super) {
20
+ __extends(OptionsValidationError, _super);
21
+ function OptionsValidationError(message, fields) {
22
+ if (fields === void 0) { fields = []; }
23
+ var _this = _super.call(this, message) || this;
24
+ _this.fields = fields;
25
+ return _this;
26
+ }
27
+ return OptionsValidationError;
28
+ }(Error));
29
+ exports.OptionsValidationError = OptionsValidationError;
30
30
  //# sourceMappingURL=OptionsValidationError.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"OptionsValidationError.js","sourceRoot":"","sources":["../../src/options/OptionsValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAA4C,0CAAK;IAG/C,gCAAY,OAAe,EAAE,MAAqB;QAArB,uBAAA,EAAA,WAAqB;QAAlD,YACE,kBAAM,OAAO,CAAC,SAEf;QADC,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IACH,6BAAC;AAAD,CAAC,AAPD,CAA4C,KAAK,GAOhD;AAPY,wDAAsB"}
1
+ {"version":3,"file":"OptionsValidationError.js","sourceRoot":"","sources":["../../src/options/OptionsValidationError.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;AAAA;IAA4C,0CAAK;IAG/C,gCAAY,OAAe,EAAE,MAAqB;QAArB,uBAAA,EAAA,WAAqB;QAChD,YAAA,MAAK,YAAC,OAAO,CAAC,SAAA;QACd,KAAI,CAAC,MAAM,GAAG,MAAM,CAAA;;IACtB,CAAC;IACH,6BAAC;AAAD,CAAC,AAPD,CAA4C,KAAK,GAOhD;AAPY,wDAAsB"}
@@ -1,14 +1,14 @@
1
- import { EnumOption } from './EnumOption';
2
- export type PlayerEnumOption<T = any> = EnumOption<T> & {
3
- mandatory?: (players: number) => T[];
4
- unavailable?: (players: number) => T[];
5
- share?: boolean;
6
- optional?: boolean;
7
- };
8
- export type PlayerIdOption<T = any> = PlayerEnumOption<T> & {
9
- share?: false;
10
- optional?: false;
11
- };
12
- export declare function getPlayersMandatoryValues<T = any>(spec: PlayerEnumOption<T>, players: number): T[];
13
- export declare function getPlayersAvailableValues<T = any>(spec: PlayerEnumOption<T>, players: number): T[];
14
- export declare function generatePlayersOption<T>(playersChoices: (T | null)[], option: PlayerEnumOption<T>): T[];
1
+ import { EnumOption } from './EnumOption';
2
+ export type PlayerEnumOption<T = any> = EnumOption<T> & {
3
+ mandatory?: (players: number) => T[];
4
+ unavailable?: (players: number) => T[];
5
+ share?: boolean;
6
+ optional?: boolean;
7
+ };
8
+ export type PlayerIdOption<T = any> = PlayerEnumOption<T> & {
9
+ share?: false;
10
+ optional?: false;
11
+ };
12
+ export declare function getPlayersMandatoryValues<T = any>(spec: PlayerEnumOption<T>, players: number): T[];
13
+ export declare function getPlayersAvailableValues<T = any>(spec: PlayerEnumOption<T>, players: number): T[];
14
+ export declare function generatePlayersOption<T>(playersChoices: (T | null)[], option: PlayerEnumOption<T>): T[];
@@ -1,67 +1,67 @@
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.generatePlayersOption = exports.getPlayersAvailableValues = exports.getPlayersMandatoryValues = void 0;
7
- var difference_1 = __importDefault(require("lodash/difference"));
8
- function getPlayersMandatoryValues(spec, players) {
9
- return spec.mandatory ? spec.mandatory(players) : [];
10
- }
11
- exports.getPlayersMandatoryValues = getPlayersMandatoryValues;
12
- function getPlayersAvailableValues(spec, players) {
13
- if (spec.unavailable) {
14
- var unavailableValues_1 = spec.unavailable(players);
15
- return spec.values.filter(function (value) { return !unavailableValues_1.includes(value); });
16
- }
17
- else {
18
- return spec.values;
19
- }
20
- }
21
- exports.getPlayersAvailableValues = getPlayersAvailableValues;
22
- function generatePlayersOption(playersChoices, option) {
23
- var mandatoryValues = getPlayersMandatoryValues(option, playersChoices.length);
24
- for (var _i = 0, mandatoryValues_1 = mandatoryValues; _i < mandatoryValues_1.length; _i++) {
25
- var mandatoryValue = mandatoryValues_1[_i];
26
- if (!playersChoices.includes(mandatoryValue)) {
27
- var freeIndexes = playersChoices.map(function (choice, i) { return choice !== null && mandatoryValues.includes(choice) ? -1 : i; }).filter(function (i) { return i !== -1; });
28
- var index = freeIndexes[Math.floor(Math.random() * freeIndexes.length)];
29
- playersChoices[index] = mandatoryValue;
30
- }
31
- }
32
- var availableValues = getPlayersAvailableValues(option, playersChoices.length);
33
- var _loop_1 = function (i) {
34
- var choice = playersChoices[i];
35
- if (choice !== null && !availableValues.includes(choice)) {
36
- playersChoices[i] = null;
37
- }
38
- if (choice !== null && !option.share) {
39
- var sameChoiceIndexes = playersChoices.map(function (c, i) { return c === choice ? i : -1; }).filter(function (i) { return i !== -1; });
40
- if (sameChoiceIndexes.length > 0) {
41
- var keeper = sameChoiceIndexes[Math.floor(Math.random() * sameChoiceIndexes.length)];
42
- for (var _a = 0, sameChoiceIndexes_1 = sameChoiceIndexes; _a < sameChoiceIndexes_1.length; _a++) {
43
- var index = sameChoiceIndexes_1[_a];
44
- if (index !== keeper) {
45
- playersChoices[index] = null;
46
- }
47
- }
48
- }
49
- }
50
- };
51
- for (var i = 0; i < playersChoices.length; i++) {
52
- _loop_1(i);
53
- }
54
- if (!option.optional) {
55
- var remainingValues = (0, difference_1.default)(availableValues, playersChoices);
56
- for (var i = 0; i < playersChoices.length; i++) {
57
- if (playersChoices[i] === null) {
58
- if (remainingValues.length === 0)
59
- remainingValues.push.apply(remainingValues, availableValues);
60
- playersChoices[i] = remainingValues.splice(Math.floor(Math.random() * remainingValues.length), 1)[0];
61
- }
62
- }
63
- }
64
- return playersChoices;
65
- }
66
- exports.generatePlayersOption = generatePlayersOption;
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.generatePlayersOption = exports.getPlayersAvailableValues = exports.getPlayersMandatoryValues = void 0;
7
+ var difference_1 = __importDefault(require("lodash/difference"));
8
+ function getPlayersMandatoryValues(spec, players) {
9
+ return spec.mandatory ? spec.mandatory(players) : [];
10
+ }
11
+ exports.getPlayersMandatoryValues = getPlayersMandatoryValues;
12
+ function getPlayersAvailableValues(spec, players) {
13
+ if (spec.unavailable) {
14
+ var unavailableValues_1 = spec.unavailable(players);
15
+ return spec.values.filter(function (value) { return !unavailableValues_1.includes(value); });
16
+ }
17
+ else {
18
+ return spec.values;
19
+ }
20
+ }
21
+ exports.getPlayersAvailableValues = getPlayersAvailableValues;
22
+ function generatePlayersOption(playersChoices, option) {
23
+ var mandatoryValues = getPlayersMandatoryValues(option, playersChoices.length);
24
+ for (var _i = 0, mandatoryValues_1 = mandatoryValues; _i < mandatoryValues_1.length; _i++) {
25
+ var mandatoryValue = mandatoryValues_1[_i];
26
+ if (!playersChoices.includes(mandatoryValue)) {
27
+ var freeIndexes = playersChoices.map(function (choice, i) { return choice !== null && mandatoryValues.includes(choice) ? -1 : i; }).filter(function (i) { return i !== -1; });
28
+ var index = freeIndexes[Math.floor(Math.random() * freeIndexes.length)];
29
+ playersChoices[index] = mandatoryValue;
30
+ }
31
+ }
32
+ var availableValues = getPlayersAvailableValues(option, playersChoices.length);
33
+ var _loop_1 = function (i) {
34
+ var choice = playersChoices[i];
35
+ if (choice !== null && !availableValues.includes(choice)) {
36
+ playersChoices[i] = null;
37
+ }
38
+ if (choice !== null && !option.share) {
39
+ var sameChoiceIndexes = playersChoices.map(function (c, i) { return c === choice ? i : -1; }).filter(function (i) { return i !== -1; });
40
+ if (sameChoiceIndexes.length > 0) {
41
+ var keeper = sameChoiceIndexes[Math.floor(Math.random() * sameChoiceIndexes.length)];
42
+ for (var _a = 0, sameChoiceIndexes_1 = sameChoiceIndexes; _a < sameChoiceIndexes_1.length; _a++) {
43
+ var index = sameChoiceIndexes_1[_a];
44
+ if (index !== keeper) {
45
+ playersChoices[index] = null;
46
+ }
47
+ }
48
+ }
49
+ }
50
+ };
51
+ for (var i = 0; i < playersChoices.length; i++) {
52
+ _loop_1(i);
53
+ }
54
+ if (!option.optional) {
55
+ var remainingValues = (0, difference_1.default)(availableValues, playersChoices);
56
+ for (var i = 0; i < playersChoices.length; i++) {
57
+ if (playersChoices[i] === null) {
58
+ if (remainingValues.length === 0)
59
+ remainingValues.push.apply(remainingValues, availableValues);
60
+ playersChoices[i] = remainingValues.splice(Math.floor(Math.random() * remainingValues.length), 1)[0];
61
+ }
62
+ }
63
+ }
64
+ return playersChoices;
65
+ }
66
+ exports.generatePlayersOption = generatePlayersOption;
67
67
  //# sourceMappingURL=PlayerEnumOption.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PlayerEnumOption.js","sourceRoot":"","sources":["../../src/options/PlayerEnumOption.ts"],"names":[],"mappings":";;;;;;AACA,iEAA0C;AAc1C,SAAgB,yBAAyB,CAAU,IAAyB,EAAE,OAAe;IAC3F,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EA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AC,CAAC,CAAC,CAAA;YACtG,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO,cAAqB,CAAA;AAC9B,CAAC;AA3CD,sDA2CC"}
@@ -1,7 +1,7 @@
1
- import { PlayerEnumOption } from './PlayerEnumOption';
2
- import { WithIdOption } from './WithIdOption';
3
- export type PlayersOptionsSpec<Options> = (Options extends WithIdOption<infer Id> ? {
4
- id: PlayerEnumOption<Id>;
5
- } : {}) & {
6
- [key in keyof Omit<Options, 'id'>]: PlayerEnumOption<Options[key]>;
7
- };
1
+ import { PlayerEnumOption } from './PlayerEnumOption';
2
+ import { WithIdOption } from './WithIdOption';
3
+ export type PlayersOptionsSpec<Options> = (Options extends WithIdOption<infer Id> ? {
4
+ id: PlayerEnumOption<Id>;
5
+ } : {}) & {
6
+ [key in keyof Omit<Options, 'id'>]: PlayerEnumOption<Options[key]>;
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=PlayersOptionsSpec.js.map
@@ -1,3 +1,3 @@
1
- export type WithIdOption<PlayerId> = {
2
- id: PlayerId;
3
- };
1
+ export type WithIdOption<PlayerId> = {
2
+ id: PlayerId;
3
+ };
@@ -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=WithIdOption.js.map
@@ -1,6 +1,6 @@
1
- import { PlayersOptionsSpec } from './PlayersOptionsSpec';
2
- import { OptionsSpec } from './OptionsSpec';
3
- export type WithPlayerOptionsSpec<P> = {
4
- players: PlayersOptionsSpec<P>;
5
- };
6
- export declare function isWithPlayerOptions<P, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
1
+ import { PlayersOptionsSpec } from './PlayersOptionsSpec';
2
+ import { OptionsSpec } from './OptionsSpec';
3
+ export type WithPlayerOptionsSpec<P> = {
4
+ players: PlayersOptionsSpec<P>;
5
+ };
6
+ export declare function isWithPlayerOptions<P, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWithPlayerOptions = void 0;
4
- function isWithPlayerOptions(optionsSpec) {
5
- return typeof optionsSpec.players === 'object';
6
- }
7
- exports.isWithPlayerOptions = isWithPlayerOptions;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWithPlayerOptions = void 0;
4
+ function isWithPlayerOptions(optionsSpec) {
5
+ return typeof optionsSpec.players === 'object';
6
+ }
7
+ exports.isWithPlayerOptions = isWithPlayerOptions;
8
8
  //# sourceMappingURL=WithPlayerOptionsSpec.js.map
@@ -1,3 +1,3 @@
1
- export type WithPlayersOptions<P> = {
2
- players: P[];
3
- };
1
+ export type WithPlayersOptions<P> = {
2
+ players: P[];
3
+ };
@@ -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=WithPlayersOptions.js.map
@@ -1,11 +1,11 @@
1
- export * from './EnumOption';
2
- export * from './isWithPlayerIdOptions';
3
- export * from './Option';
4
- export * from './OptionSpecOf';
5
- export * from './OptionsSpec';
6
- export * from './OptionsValidationError';
7
- export * from './PlayerEnumOption';
8
- export * from './PlayersOptionsSpec';
9
- export * from './WithIdOption';
10
- export * from './WithPlayerOptionsSpec';
11
- export * from './WithPlayersOptions';
1
+ export * from './EnumOption';
2
+ export * from './isWithPlayerIdOptions';
3
+ export * from './Option';
4
+ export * from './OptionSpecOf';
5
+ export * from './OptionsSpec';
6
+ export * from './OptionsValidationError';
7
+ export * from './PlayerEnumOption';
8
+ export * from './PlayersOptionsSpec';
9
+ export * from './WithIdOption';
10
+ export * from './WithPlayerOptionsSpec';
11
+ export * from './WithPlayersOptions';
@@ -1,28 +1,28 @@
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("./EnumOption"), exports);
18
- __exportStar(require("./isWithPlayerIdOptions"), exports);
19
- __exportStar(require("./Option"), exports);
20
- __exportStar(require("./OptionSpecOf"), exports);
21
- __exportStar(require("./OptionsSpec"), exports);
22
- __exportStar(require("./OptionsValidationError"), exports);
23
- __exportStar(require("./PlayerEnumOption"), exports);
24
- __exportStar(require("./PlayersOptionsSpec"), exports);
25
- __exportStar(require("./WithIdOption"), exports);
26
- __exportStar(require("./WithPlayerOptionsSpec"), exports);
27
- __exportStar(require("./WithPlayersOptions"), exports);
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("./EnumOption"), exports);
18
+ __exportStar(require("./isWithPlayerIdOptions"), exports);
19
+ __exportStar(require("./Option"), exports);
20
+ __exportStar(require("./OptionSpecOf"), exports);
21
+ __exportStar(require("./OptionsSpec"), exports);
22
+ __exportStar(require("./OptionsValidationError"), exports);
23
+ __exportStar(require("./PlayerEnumOption"), exports);
24
+ __exportStar(require("./PlayersOptionsSpec"), exports);
25
+ __exportStar(require("./WithIdOption"), exports);
26
+ __exportStar(require("./WithPlayerOptionsSpec"), exports);
27
+ __exportStar(require("./WithPlayersOptions"), exports);
28
28
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { OptionsSpec } from './OptionsSpec';
2
- import { WithIdOption } from './WithIdOption';
3
- import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
- export declare function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
1
+ import { OptionsSpec } from './OptionsSpec';
2
+ import { WithIdOption } from './WithIdOption';
3
+ import { WithPlayerOptionsSpec } from './WithPlayerOptionsSpec';
4
+ export declare function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
@@ -1,12 +1,12 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isWithPlayerIdOptions = void 0;
4
- function isWithPlayerIdOptions(optionsSpec) {
5
- var playersOptions = optionsSpec === null || optionsSpec === void 0 ? void 0 : optionsSpec.players;
6
- if (!playersOptions)
7
- return false;
8
- var idOptions = playersOptions.id;
9
- return !!idOptions;
10
- }
11
- exports.isWithPlayerIdOptions = isWithPlayerIdOptions;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isWithPlayerIdOptions = void 0;
4
+ function isWithPlayerIdOptions(optionsSpec) {
5
+ var playersOptions = optionsSpec === null || optionsSpec === void 0 ? void 0 : optionsSpec.players;
6
+ if (!playersOptions)
7
+ return false;
8
+ var idOptions = playersOptions.id;
9
+ return !!idOptions;
10
+ }
11
+ exports.isWithPlayerIdOptions = isWithPlayerIdOptions;
12
12
  //# sourceMappingURL=isWithPlayerIdOptions.js.map
@@ -1 +1 @@
1
- export declare function isEnumValue<T>(value: string | T): value is T;
1
+ export declare function isEnumValue<T>(value: string | T): value is T;
@@ -1,8 +1,8 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isEnumValue = void 0;
4
- function isEnumValue(value) {
5
- return typeof value !== 'string';
6
- }
7
- exports.isEnumValue = isEnumValue;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isEnumValue = void 0;
4
+ function isEnumValue(value) {
5
+ return typeof value !== 'string';
6
+ }
7
+ exports.isEnumValue = isEnumValue;
8
8
  //# sourceMappingURL=EnumUtils.js.map
@@ -1,11 +1,11 @@
1
- import { XYCoordinates } from './grid.util';
2
- export declare const areAdjacentSquares: (square1: Partial<XYCoordinates>, square2: Partial<XYCoordinates>) => boolean;
3
- export declare const getDistanceBetweenSquares: (square1: XYCoordinates, square2: XYCoordinates) => number;
4
- export declare enum Direction {
5
- North = 1,
6
- South = 2,
7
- East = 3,
8
- West = 4
9
- }
10
- export declare const directions: Direction[];
11
- export declare const getSquareInDirection: (origin: Partial<XYCoordinates>, direction: Direction) => XYCoordinates;
1
+ import { XYCoordinates } from './grid.util';
2
+ export declare const areAdjacentSquares: (square1: Partial<XYCoordinates>, square2: Partial<XYCoordinates>) => boolean;
3
+ export declare const getDistanceBetweenSquares: (square1: XYCoordinates, square2: XYCoordinates) => number;
4
+ export declare enum Direction {
5
+ North = 1,
6
+ South = 2,
7
+ East = 3,
8
+ West = 4
9
+ }
10
+ export declare const directions: Direction[];
11
+ export declare const getSquareInDirection: (origin: Partial<XYCoordinates>, direction: Direction) => XYCoordinates;