@gamepark/rules-api 6.19.0 → 6.21.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 +5 -6
  43. package/dist/Undo.js +8 -8
  44. package/dist/Undo.js.map +1 -1
  45. package/dist/UnpredictableMove.d.ts +5 -5
  46. package/dist/UnpredictableMove.js +5 -5
  47. package/dist/index.d.ts +21 -20
  48. package/dist/index.js +37 -36
  49. package/dist/index.js.map +1 -1
  50. package/dist/material/HiddenMaterialRules.d.ts +36 -35
  51. package/dist/material/HiddenMaterialRules.js +245 -245
  52. package/dist/material/HiddenMaterialRules.js.map +1 -1
  53. package/dist/material/MaterialGame.d.ts +15 -15
  54. package/dist/material/MaterialGame.js +2 -2
  55. package/dist/material/MaterialGameSetup.d.ts +21 -21
  56. package/dist/material/MaterialGameSetup.js +75 -75
  57. package/dist/material/MaterialGameSetup.js.map +1 -1
  58. package/dist/material/MaterialRules.d.ts +44 -44
  59. package/dist/material/MaterialRules.js +240 -242
  60. package/dist/material/MaterialRules.js.map +1 -1
  61. package/dist/material/SecretMaterialRules.d.ts +13 -13
  62. package/dist/material/SecretMaterialRules.js +37 -37
  63. package/dist/material/index.d.ts +10 -10
  64. package/dist/material/index.js +26 -26
  65. package/dist/material/items/Material.d.ts +59 -60
  66. package/dist/material/items/Material.js +406 -405
  67. package/dist/material/items/Material.js.map +1 -1
  68. package/dist/material/items/MaterialItem.d.ts +7 -7
  69. package/dist/material/items/MaterialItem.js +2 -2
  70. package/dist/material/items/MaterialMutator.d.ts +31 -31
  71. package/dist/material/items/MaterialMutator.js +277 -277
  72. package/dist/material/items/MaterialMutator.js.map +1 -1
  73. package/dist/material/items/index.d.ts +3 -3
  74. package/dist/material/items/index.js +19 -19
  75. package/dist/material/location/Location.d.ts +11 -11
  76. package/dist/material/location/Location.js +2 -2
  77. package/dist/material/location/LocationBuilder.d.ts +12 -12
  78. package/dist/material/location/LocationBuilder.js +40 -40
  79. package/dist/material/location/index.d.ts +3 -3
  80. package/dist/material/location/index.js +19 -19
  81. package/dist/material/location/strategy/FillGapStrategy.d.ts +7 -7
  82. package/dist/material/location/strategy/FillGapStrategy.js +23 -23
  83. package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
  84. package/dist/material/location/strategy/LocationStrategy.d.ts +6 -6
  85. package/dist/material/location/strategy/LocationStrategy.js +2 -2
  86. package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +9 -9
  87. package/dist/material/location/strategy/PositiveSequenceStrategy.js +65 -65
  88. package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
  89. package/dist/material/location/strategy/index.d.ts +3 -3
  90. package/dist/material/location/strategy/index.js +19 -19
  91. package/dist/material/memory/GameMemory.d.ts +8 -8
  92. package/dist/material/memory/GameMemory.js +27 -27
  93. package/dist/material/memory/GameMemory.js.map +1 -1
  94. package/dist/material/memory/PlayerMemory.d.ts +9 -9
  95. package/dist/material/memory/PlayerMemory.js +32 -32
  96. package/dist/material/memory/PlayerMemory.js.map +1 -1
  97. package/dist/material/memory/index.d.ts +2 -2
  98. package/dist/material/memory/index.js +18 -18
  99. package/dist/material/moves/CustomMove.d.ts +9 -9
  100. package/dist/material/moves/CustomMove.js +10 -10
  101. package/dist/material/moves/MaterialMove.d.ts +7 -7
  102. package/dist/material/moves/MaterialMove.js +2 -2
  103. package/dist/material/moves/MoveKind.d.ts +6 -6
  104. package/dist/material/moves/MoveKind.js +10 -10
  105. package/dist/material/moves/MoveKind.js.map +1 -1
  106. package/dist/material/moves/index.d.ts +6 -6
  107. package/dist/material/moves/index.js +22 -22
  108. package/dist/material/moves/items/CreateItem.d.ts +10 -10
  109. package/dist/material/moves/items/CreateItem.js +15 -15
  110. package/dist/material/moves/items/CreateItemsAtOnce.d.ts +10 -10
  111. package/dist/material/moves/items/CreateItemsAtOnce.js +15 -15
  112. package/dist/material/moves/items/DeleteItem.d.ts +10 -10
  113. package/dist/material/moves/items/DeleteItem.js +15 -15
  114. package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +9 -9
  115. package/dist/material/moves/items/DeleteItemsAtOnce.js +15 -15
  116. package/dist/material/moves/items/ItemMove.d.ts +17 -17
  117. package/dist/material/moves/items/ItemMove.js +2 -2
  118. package/dist/material/moves/items/ItemMoveType.d.ts +11 -11
  119. package/dist/material/moves/items/ItemMoveType.js +15 -15
  120. package/dist/material/moves/items/ItemMoveType.js.map +1 -1
  121. package/dist/material/moves/items/ItemMovesBuilder.d.ts +8 -8
  122. package/dist/material/moves/items/ItemMovesBuilder.js +33 -33
  123. package/dist/material/moves/items/ItemMovesBuilder.js.map +1 -1
  124. package/dist/material/moves/items/MoveItem.d.ts +14 -14
  125. package/dist/material/moves/items/MoveItem.js +15 -15
  126. package/dist/material/moves/items/MoveItemsAtOnce.d.ts +13 -13
  127. package/dist/material/moves/items/MoveItemsAtOnce.js +15 -15
  128. package/dist/material/moves/items/RollItem.d.ts +11 -11
  129. package/dist/material/moves/items/RollItem.js +15 -15
  130. package/dist/material/moves/items/SelectItem.d.ts +11 -11
  131. package/dist/material/moves/items/SelectItem.js +15 -15
  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 +34 -39
  139. package/dist/material/moves/local/DisplayHelp.js +28 -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 +11 -12
  144. package/dist/material/moves/local/LocalMove.js +10 -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
package/dist/Action.d.ts CHANGED
@@ -1,25 +1,25 @@
1
- import { Rules } from './Rules';
2
- import { IncompleteInformation } from './IncompleteInformation';
3
- export type Action<Move = any, PlayerId = any> = {
4
- id?: string;
5
- playerId: PlayerId;
6
- move: Move;
7
- consequences: Move[];
8
- };
9
- export declare function playMove<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, move: Move): void;
10
- export declare function playAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, move: Move, playerId: PlayerId): Action<Move, PlayerId>;
11
- export type ActionWithViews<Move = any, MoveView = Move, PlayerId = any> = {
12
- action: Action<Move, PlayerId>;
13
- views: ActionView<MoveView, PlayerId>[];
14
- };
15
- export type ActionView<MoveView = any, PlayerId = any> = {
16
- recipient?: PlayerId;
17
- action: Action<MoveView, PlayerId>;
18
- };
19
- export declare function playActionWithViews<Game, View, Move, MoveView, PlayerId>(rules: Rules<Game, Move, PlayerId> & IncompleteInformation<View, Move, MoveView>, move: Move, playerId: PlayerId, recipients: PlayerId[], id?: string): ActionWithViews<Move, MoveView, PlayerId>;
20
- export declare function replayAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, action: Action<Move, PlayerId>): void;
21
- export declare function replayActions<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, actions: Action<Move, PlayerId>[]): void;
22
- export type SecretAction<Move = any, MoveView = Move, PlayerId = any> = Action<Move, PlayerId> & {
23
- secrets: ActionView<MoveView, PlayerId>[];
24
- };
25
- export declare function isSecretAction(action: Action): action is SecretAction;
1
+ import { Rules } from './Rules';
2
+ import { IncompleteInformation } from './IncompleteInformation';
3
+ export type Action<Move = any, PlayerId = any> = {
4
+ id?: string;
5
+ playerId: PlayerId;
6
+ move: Move;
7
+ consequences: Move[];
8
+ };
9
+ export declare function playMove<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, move: Move): void;
10
+ export declare function playAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, move: Move, playerId: PlayerId): Action<Move, PlayerId>;
11
+ export type ActionWithViews<Move = any, MoveView = Move, PlayerId = any> = {
12
+ action: Action<Move, PlayerId>;
13
+ views: ActionView<MoveView, PlayerId>[];
14
+ };
15
+ export type ActionView<MoveView = any, PlayerId = any> = {
16
+ recipient?: PlayerId;
17
+ action: Action<MoveView, PlayerId>;
18
+ };
19
+ export declare function playActionWithViews<Game, View, Move, MoveView, PlayerId>(rules: Rules<Game, Move, PlayerId> & IncompleteInformation<View, Move, MoveView>, move: Move, playerId: PlayerId, recipients: PlayerId[], id?: string): ActionWithViews<Move, MoveView, PlayerId>;
20
+ export declare function replayAction<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, action: Action<Move, PlayerId>): void;
21
+ export declare function replayActions<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, actions: Action<Move, PlayerId>[]): void;
22
+ export type SecretAction<Move = any, MoveView = Move, PlayerId = any> = Action<Move, PlayerId> & {
23
+ secrets: ActionView<MoveView, PlayerId>[];
24
+ };
25
+ export declare function isSecretAction(action: Action): action is SecretAction;
package/dist/Action.js CHANGED
@@ -1,62 +1,62 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.isSecretAction = exports.replayActions = exports.replayAction = exports.playActionWithViews = exports.playAction = exports.playMove = void 0;
4
- var RandomMove_1 = require("./RandomMove");
5
- var ApplyAutomaticMoves_1 = require("./ApplyAutomaticMoves");
6
- var IncompleteInformation_1 = require("./IncompleteInformation");
7
- function playMove(rules, move) {
8
- if ((0, RandomMove_1.hasRandomMove)(rules)) {
9
- move = rules.randomize(move);
10
- }
11
- var consequences = rules.play(JSON.parse(JSON.stringify(move)));
12
- (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences);
13
- }
14
- exports.playMove = playMove;
15
- function playAction(rules, move, playerId) {
16
- if ((0, RandomMove_1.hasRandomMove)(rules)) {
17
- move = rules.randomize(move);
18
- }
19
- var action = { playerId: playerId, move: move, consequences: [] };
20
- var consequences = rules.play(JSON.parse(JSON.stringify(move)));
21
- (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences, function (move) { return action.consequences.push(move); });
22
- return action;
23
- }
24
- exports.playAction = playAction;
25
- function playActionWithViews(rules, move, playerId, recipients, id) {
26
- if ((0, RandomMove_1.hasRandomMove)(rules)) {
27
- move = rules.randomize(move);
28
- }
29
- var actionWithView = {
30
- action: { id: id, playerId: playerId, move: move, consequences: [] },
31
- views: []
32
- };
33
- for (var _i = 0, recipients_1 = recipients; _i < recipients_1.length; _i++) {
34
- var recipient = recipients_1[_i];
35
- actionWithView.views.push({ recipient: recipient, action: { id: id, playerId: playerId, move: (0, IncompleteInformation_1.getMoveView)(rules, move, recipient), consequences: [] } });
36
- }
37
- actionWithView.views.push({ action: { id: id, playerId: playerId, move: (0, IncompleteInformation_1.getMoveView)(rules, move), consequences: [] } });
38
- var consequences = rules.play(JSON.parse(JSON.stringify(move)));
39
- (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences, function (move) {
40
- actionWithView.action.consequences.push(move);
41
- for (var _i = 0, _a = actionWithView.views; _i < _a.length; _i++) {
42
- var view = _a[_i];
43
- view.action.consequences.push((0, IncompleteInformation_1.getMoveView)(rules, move, view.recipient));
44
- }
45
- });
46
- return actionWithView;
47
- }
48
- exports.playActionWithViews = playActionWithViews;
49
- function replayAction(rules, action) {
50
- rules.play(JSON.parse(JSON.stringify(action.move)));
51
- action.consequences.forEach(function (move) { return rules.play(JSON.parse(JSON.stringify(move))); });
52
- }
53
- exports.replayAction = replayAction;
54
- function replayActions(rules, actions) {
55
- actions.forEach(function (action) { return replayAction(rules, action); });
56
- }
57
- exports.replayActions = replayActions;
58
- function isSecretAction(action) {
59
- return Array.isArray(action.secrets);
60
- }
61
- exports.isSecretAction = isSecretAction;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isSecretAction = exports.replayActions = exports.replayAction = exports.playActionWithViews = exports.playAction = exports.playMove = void 0;
4
+ var RandomMove_1 = require("./RandomMove");
5
+ var ApplyAutomaticMoves_1 = require("./ApplyAutomaticMoves");
6
+ var IncompleteInformation_1 = require("./IncompleteInformation");
7
+ function playMove(rules, move) {
8
+ if ((0, RandomMove_1.hasRandomMove)(rules)) {
9
+ move = rules.randomize(move);
10
+ }
11
+ var consequences = rules.play(JSON.parse(JSON.stringify(move)));
12
+ (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences);
13
+ }
14
+ exports.playMove = playMove;
15
+ function playAction(rules, move, playerId) {
16
+ if ((0, RandomMove_1.hasRandomMove)(rules)) {
17
+ move = rules.randomize(move);
18
+ }
19
+ var action = { playerId: playerId, move: move, consequences: [] };
20
+ var consequences = rules.play(JSON.parse(JSON.stringify(move)));
21
+ (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences, function (move) { return action.consequences.push(move); });
22
+ return action;
23
+ }
24
+ exports.playAction = playAction;
25
+ function playActionWithViews(rules, move, playerId, recipients, id) {
26
+ if ((0, RandomMove_1.hasRandomMove)(rules)) {
27
+ move = rules.randomize(move);
28
+ }
29
+ var actionWithView = {
30
+ action: { id: id, playerId: playerId, move: move, consequences: [] },
31
+ views: []
32
+ };
33
+ for (var _i = 0, recipients_1 = recipients; _i < recipients_1.length; _i++) {
34
+ var recipient = recipients_1[_i];
35
+ actionWithView.views.push({ recipient: recipient, action: { id: id, playerId: playerId, move: (0, IncompleteInformation_1.getMoveView)(rules, move, recipient), consequences: [] } });
36
+ }
37
+ actionWithView.views.push({ action: { id: id, playerId: playerId, move: (0, IncompleteInformation_1.getMoveView)(rules, move), consequences: [] } });
38
+ var consequences = rules.play(JSON.parse(JSON.stringify(move)));
39
+ (0, ApplyAutomaticMoves_1.applyAutomaticMoves)(rules, consequences, function (move) {
40
+ actionWithView.action.consequences.push(move);
41
+ for (var _i = 0, _a = actionWithView.views; _i < _a.length; _i++) {
42
+ var view = _a[_i];
43
+ view.action.consequences.push((0, IncompleteInformation_1.getMoveView)(rules, move, view.recipient));
44
+ }
45
+ });
46
+ return actionWithView;
47
+ }
48
+ exports.playActionWithViews = playActionWithViews;
49
+ function replayAction(rules, action) {
50
+ rules.play(JSON.parse(JSON.stringify(action.move)));
51
+ action.consequences.forEach(function (move) { return rules.play(JSON.parse(JSON.stringify(move))); });
52
+ }
53
+ exports.replayAction = replayAction;
54
+ function replayActions(rules, actions) {
55
+ actions.forEach(function (action) { return replayAction(rules, action); });
56
+ }
57
+ exports.replayActions = replayActions;
58
+ function isSecretAction(action) {
59
+ return Array.isArray(action.secrets);
60
+ }
61
+ exports.isSecretAction = is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AAC,UAAA,IAAI,IAAI,OAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAA5C,CAA4C,CAAC,CAAA;AACnF,CAAC;AAHD,oCAGC;AAED,SAAgB,aAAa,CAAuB,KAAkC,EAAE,OAAiC;IACvH,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,YAAY,CAAC,KAAK,EAAE,MAAM,CAAC,EAA3B,CAA2B,CAAC,CAAA;AACxD,CAAC;AAFD,sCAEC;AAMD,SAAgB,cAAc,CAAC,MAAc;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAE,MAAuB,CAAC,OAAO,CAAC,CAAA;AACxD,CAAC;AAFD,wCAEC"}
@@ -1,2 +1,2 @@
1
- import { Rules } from './Rules';
2
- export declare function applyAutomaticMoves<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, moves?: Move[], preprocessMove?: (move: Move) => void): void;
1
+ import { Rules } from './Rules';
2
+ export declare function applyAutomaticMoves<Game, Move, PlayerId>(rules: Rules<Game, Move, PlayerId>, moves?: Move[], preprocessMove?: (move: Move) => void): void;
@@ -1,25 +1,25 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.applyAutomaticMoves = void 0;
4
- var RandomMove_1 = require("./RandomMove");
5
- var LoopWithFuse_1 = require("./LoopWithFuse");
6
- function applyAutomaticMoves(rules, moves, preprocessMove) {
7
- if (moves === void 0) { moves = []; }
8
- (0, LoopWithFuse_1.loopWithFuse)(function () {
9
- var _a;
10
- if (moves.length === 0 && rules.getAutomaticMoves) {
11
- moves.push.apply(moves, rules.getAutomaticMoves());
12
- }
13
- var move = moves.shift();
14
- if (!move)
15
- return false;
16
- var randomizedMove = (0, RandomMove_1.hasRandomMove)(rules) ? rules.randomize(move) : move;
17
- if (preprocessMove)
18
- preprocessMove(randomizedMove);
19
- var consequences = (_a = rules.play(JSON.parse(JSON.stringify(randomizedMove)))) !== null && _a !== void 0 ? _a : [];
20
- moves.unshift.apply(moves, consequences);
21
- return true;
22
- }, { errorFn: function () { return new Error("Infinite loop detected while applying move consequences: ".concat(JSON.stringify(moves), ")")); } });
23
- }
24
- exports.applyAutomaticMoves = applyAutomaticMoves;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.applyAutomaticMoves = void 0;
4
+ var RandomMove_1 = require("./RandomMove");
5
+ var LoopWithFuse_1 = require("./LoopWithFuse");
6
+ function applyAutomaticMoves(rules, moves, preprocessMove) {
7
+ if (moves === void 0) { moves = []; }
8
+ (0, LoopWithFuse_1.loopWithFuse)(function () {
9
+ var _a;
10
+ if (moves.length === 0 && rules.getAutomaticMoves) {
11
+ moves.push.apply(moves, rules.getAutomaticMoves());
12
+ }
13
+ var move = moves.shift();
14
+ if (!move)
15
+ return false;
16
+ var randomizedMove = (0, RandomMove_1.hasRandomMove)(rules) ? rules.randomize(move) : move;
17
+ if (preprocessMove)
18
+ preprocessMove(randomizedMove);
19
+ var consequences = (_a = rules.play(JSON.parse(JSON.stringify(randomizedMove)))) !== null && _a !== void 0 ? _a : [];
20
+ moves.unshift.apply(moves, consequences);
21
+ return true;
22
+ }, { errorFn: function () { return new Error("Infinite loop detected while applying move consequences: ".concat(JSON.stringify(moves), ")")); } });
23
+ }
24
+ exports.applyAutomaticMoves = applyAutomaticMoves;
25
25
  //# sourceMappingURL=ApplyAutomaticMoves.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ApplyAutomaticMoves.js","sourceRoot":"","sources":["../src/ApplyAutomaticMoves.ts"],"names":[],"mappings":";;;AAAA,2CAA4C;AAC5C,+CAA6C;AAG7C,SAAgB,mBAAmB,CAAuB,KAAkC,EAAE,KAAkB,EAAE,cAAqC;IAAzD,sBAAA,EAAA,UAAkB;IAC9G,IAAA,2BAAY,EAAC;;QACX,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,IAAI,KAAK,CAAC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AK,CAAC,KAAK,EAAE,CAAA;QAC1B,IAAI,CAAC,IAAI;YAAE,OAAO,KAAK,CAAA;QACvB,IAAM,cAAc,GAAG,IAAA,0BAAa,EAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAA;QAC1E,IAAI,cAAc;YAAE,cAAc,CAAC,cAAc,CAAC,CAAA;QAClD,IAAM,YAAY,GAAG,MAAA,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,CAAC,CAAC,mCAAI,EAAE,CAAA;QACjF,KAAK,CAAC,OAAO,OAAb,KAAK,EAAY,YAAY,EAAC;QAC9B,OAAO,IAAI,CAAA;IACb,CAAC,EAAE,EAAC,OAAO,EAAE,cAAM,OAAA,IAAI,KAAK,CAAC,mEAA4D,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,MAAG,CAAC,EAA/F,CAA+F,EAAC,CAAC,CAAA;AACtH,CAAC;AAbD,kDAaC"}
@@ -1,13 +1,13 @@
1
- import { Rules } from './Rules';
2
- export type Competitive<Game = any, Move = any, PlayerId = any> = CompetitiveScore<Game, Move, PlayerId> | CompetitiveRank<Game, Move, PlayerId>;
3
- export interface CompetitiveScore<Game = any, Move = any, PlayerId = any> extends Rules<Game, Move, PlayerId> {
4
- getScore(playerId: PlayerId): number;
5
- getTieBreaker?(tieBreaker: number, playerId: PlayerId): number | undefined;
6
- }
7
- export interface CompetitiveRank<Game = any, Move = any, PlayerId = any> extends Rules<Game, Move, PlayerId> {
8
- rankPlayers(playerA: PlayerId, playerB: PlayerId): number;
9
- }
10
- export declare function isCompetitive<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is Competitive<Game, Move, PlayerId>;
11
- export declare function isCompetitiveScore<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is CompetitiveScore<Game, Move, PlayerId>;
12
- export declare function isCompetitiveRank<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is CompetitiveRank<Game, Move, PlayerId>;
13
- export declare const rankPlayers: <PlayerId = number>(rules: Rules<any, any, PlayerId>, playerA: PlayerId, playerB: PlayerId) => number;
1
+ import { Rules } from './Rules';
2
+ export type Competitive<Game = any, Move = any, PlayerId = any> = CompetitiveScore<Game, Move, PlayerId> | CompetitiveRank<Game, Move, PlayerId>;
3
+ export interface CompetitiveScore<Game = any, Move = any, PlayerId = any> extends Rules<Game, Move, PlayerId> {
4
+ getScore(playerId: PlayerId): number;
5
+ getTieBreaker?(tieBreaker: number, playerId: PlayerId): number | undefined;
6
+ }
7
+ export interface CompetitiveRank<Game = any, Move = any, PlayerId = any> extends Rules<Game, Move, PlayerId> {
8
+ rankPlayers(playerA: PlayerId, playerB: PlayerId): number;
9
+ }
10
+ export declare function isCompetitive<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is Competitive<Game, Move, PlayerId>;
11
+ export declare function isCompetitiveScore<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is CompetitiveScore<Game, Move, PlayerId>;
12
+ export declare function isCompetitiveRank<Game, Move, PlayerId>(rules: Rules<any, any, PlayerId>): rules is CompetitiveRank<Game, Move, PlayerId>;
13
+ export declare const rankPlayers: <PlayerId = number>(rules: Rules<any, any, PlayerId>, playerA: PlayerId, playerB: PlayerId) => number;
@@ -1,46 +1,46 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.rankPlayers = exports.isCompetitiveRank = exports.isCompetitiveScore = exports.isCompetitive = void 0;
4
- function isCompetitive(rules) {
5
- return isCompetitiveScore(rules) || isCompetitiveRank(rules);
6
- }
7
- exports.isCompetitive = isCompetitive;
8
- function isCompetitiveScore(rules) {
9
- return typeof rules.getScore === 'function';
10
- }
11
- exports.isCompetitiveScore = isCompetitiveScore;
12
- function isCompetitiveRank(rules) {
13
- return typeof rules.rankPlayers === 'function';
14
- }
15
- exports.isCompetitiveRank = isCompetitiveRank;
16
- var rankPlayers = function (rules, playerA, playerB) {
17
- if (isCompetitiveRank(rules)) {
18
- return rules.rankPlayers(playerA, playerB);
19
- }
20
- if (isCompetitiveScore(rules)) {
21
- var scoreA = rules.getScore(playerA);
22
- var scoreB = rules.getScore(playerB);
23
- if (scoreA !== scoreB) {
24
- return scoreB - scoreA;
25
- }
26
- if (rules.getTieBreaker) {
27
- for (var tieBreaker = 1; tieBreaker <= 10; tieBreaker++) {
28
- var tieBreakerA = rules.getTieBreaker(tieBreaker, playerA);
29
- var tieBreakerB = rules.getTieBreaker(tieBreaker, playerB);
30
- if (tieBreakerA === undefined) {
31
- return tieBreakerB === undefined ? 0 : Infinity;
32
- }
33
- else if (tieBreakerB === undefined) {
34
- return -Infinity;
35
- }
36
- else if (tieBreakerA !== tieBreakerB) {
37
- return tieBreakerB - tieBreakerA;
38
- }
39
- }
40
- console.error('getTieBreaker must return "undefined" after the last tie breaker is still a tie!');
41
- }
42
- }
43
- return 0;
44
- };
45
- exports.rankPlayers = rankPlayers;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.rankPlayers = exports.isCompetitiveRank = exports.isCompetitiveScore = exports.isCompetitive = void 0;
4
+ function isCompetitive(rules) {
5
+ return isCompetitiveScore(rules) || isCompetitiveRank(rules);
6
+ }
7
+ exports.isCompetitive = isCompetitive;
8
+ function isCompetitiveScore(rules) {
9
+ return typeof rules.getScore === 'function';
10
+ }
11
+ exports.isCompetitiveScore = isCompetitiveScore;
12
+ function isCompetitiveRank(rules) {
13
+ return typeof rules.rankPlayers === 'function';
14
+ }
15
+ exports.isCompetitiveRank = isCompetitiveRank;
16
+ var rankPlayers = function (rules, playerA, playerB) {
17
+ if (isCompetitiveRank(rules)) {
18
+ return rules.rankPlayers(playerA, playerB);
19
+ }
20
+ if (isCompetitiveScore(rules)) {
21
+ var scoreA = rules.getScore(playerA);
22
+ var scoreB = rules.getScore(playerB);
23
+ if (scoreA !== scoreB) {
24
+ return scoreB - scoreA;
25
+ }
26
+ if (rules.getTieBreaker) {
27
+ for (var tieBreaker = 1; tieBreaker <= 10; tieBreaker++) {
28
+ var tieBreakerA = rules.getTieBreaker(tieBreaker, playerA);
29
+ var tieBreakerB = rules.getTieBreaker(tieBreaker, playerB);
30
+ if (tieBreakerA === undefined) {
31
+ return tieBreakerB === undefined ? 0 : Infinity;
32
+ }
33
+ else if (tieBreakerB === undefined) {
34
+ return -Infinity;
35
+ }
36
+ else if (tieBreakerA !== tieBreakerB) {
37
+ return tieBreakerB - tieBreakerA;
38
+ }
39
+ }
40
+ console.error('getTieBreaker must return "undefined" after the last tie breaker is still a tie!');
41
+ }
42
+ }
43
+ return 0;
44
+ };
45
+ exports.rankPlayers = rankPlayers;
46
46
  //# sourceMappingURL=Competitive.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Competitive.js","sourceRoot":"","sources":["../src/Competitive.ts"],"names":[],"mappings":";;;AAcA,SAAgB,aAAa,CAAuB,KAAgC;IAClF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAC9D,CAAC;AAFD,sCAEC;AAED,SAAgB,kBAAkB,CAAuB,KAAgC;IACvF,OAAO,OAAQ,KAAgD,CAAC,QAAQ,KAAK,UAAU,CAAA;AACzF,CAAC;AAFD,gDAEC;AAED,SAAgB,iBAAiB,CAAuB,KAAgC;IACtF,OAAO,OAAQ,KAA+C,CAAC,WAAW,KAAK,UAAU,CAAA;AAC3F,CAAC;AAFD,8CAEC;AAEM,IAAM,WAAW,GAAG,UAAoB,KAAgC,EAAE,OAAiB,EAAE,OAAiB;IACnH,IAAI,iBAAiB,CAAC,KAAK,CAAC,EAAE;QAC5B,OAAO,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;KAC3C;IACD,IAAI,kBAAkB,CAAC,KAAK,CAAC,EAAE;QAC7B,IAAM,MAAM,GAAG,KAAK,CA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AAkF,CAAC,CAAA;QACnG,CAAC;IACH,CAAC;IACD,OAAO,CAAC,CAAA;AACV,CAAC,CAAA;AA1BY,QAAA,WAAW,eA0BvB"}
@@ -1,7 +1,7 @@
1
- import { RulesCreator } from './RulesCreator';
2
- import { GameSetup } from './GameSetup';
3
- export declare class DefaultGameSetup<Game = any, Move = any, PlayerId = any, Options = any> implements GameSetup<Game, Options> {
4
- private readonly Rules;
5
- constructor(Rules: RulesCreator<Game, Move, PlayerId, Options>);
6
- setup(options: Options): any;
7
- }
1
+ import { RulesCreator } from './RulesCreator';
2
+ import { GameSetup } from './GameSetup';
3
+ export declare class DefaultGameSetup<Game = any, Move = any, PlayerId = any, Options = any> implements GameSetup<Game, Options> {
4
+ private readonly Rules;
5
+ constructor(Rules: RulesCreator<Game, Move, PlayerId, Options>);
6
+ setup(options: Options): any;
7
+ }
@@ -1,15 +1,15 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DefaultGameSetup = void 0;
4
- var DefaultGameSetup = (function () {
5
- function DefaultGameSetup(Rules) {
6
- this.Rules = Rules;
7
- }
8
- DefaultGameSetup.prototype.setup = function (options) {
9
- var rules = new this.Rules(options);
10
- return rules.game;
11
- };
12
- return DefaultGameSetup;
13
- }());
14
- exports.DefaultGameSetup = DefaultGameSetup;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DefaultGameSetup = void 0;
4
+ var DefaultGameSetup = (function () {
5
+ function DefaultGameSetup(Rules) {
6
+ this.Rules = Rules;
7
+ }
8
+ DefaultGameSetup.prototype.setup = function (options) {
9
+ var rules = new this.Rules(options);
10
+ return rules.game;
11
+ };
12
+ return DefaultGameSetup;
13
+ }());
14
+ exports.DefaultGameSetup = DefaultGameSetup;
15
15
  //# sourceMappingURL=DefaultGameSetup.js.map
package/dist/Dummy.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { RulesCreator } from './RulesCreator';
2
- export declare class Dummy<Game, Move = string, PlayerId = number> {
3
- Rules: RulesCreator<Game, Move, PlayerId>;
4
- constructor(Rules: RulesCreator<Game, Move, PlayerId>);
5
- getRandomMove(state: Game, playerId: PlayerId): Promise<Move[]>;
6
- getLegalMoves(state: Game, player: PlayerId): Move[];
7
- }
1
+ import { RulesCreator } from './RulesCreator';
2
+ export declare class Dummy<Game, Move = string, PlayerId = number> {
3
+ Rules: RulesCreator<Game, Move, PlayerId>;
4
+ constructor(Rules: RulesCreator<Game, Move, PlayerId>);
5
+ getRandomMove(state: Game, playerId: PlayerId): Promise<Move[]>;
6
+ getLegalMoves(state: Game, player: PlayerId): Move[];
7
+ }
package/dist/Dummy.js CHANGED
@@ -1,27 +1,27 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Dummy = void 0;
4
- var Dummy = (function () {
5
- function Dummy(Rules) {
6
- this.Rules = Rules;
7
- }
8
- Dummy.prototype.getRandomMove = function (state, playerId) {
9
- var moves = this.getLegalMoves(state, playerId);
10
- if (!moves.length)
11
- return Promise.resolve([]);
12
- return Promise.resolve([moves[Math.floor(Math.random() * moves.length)]]);
13
- };
14
- Dummy.prototype.getLegalMoves = function (state, player) {
15
- var rules = new this.Rules(state, { player: player });
16
- if (rules.getLegalMoves) {
17
- return rules.getLegalMoves(player);
18
- }
19
- else {
20
- console.error('Dummy player cannot work if getLegalMoves is not implemented!');
21
- return [];
22
- }
23
- };
24
- return Dummy;
25
- }());
26
- exports.Dummy = Dummy;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Dummy = void 0;
4
+ var Dummy = (function () {
5
+ function Dummy(Rules) {
6
+ this.Rules = Rules;
7
+ }
8
+ Dummy.prototype.getRandomMove = function (state, playerId) {
9
+ var moves = this.getLegalMoves(state, playerId);
10
+ if (!moves.length)
11
+ return Promise.resolve([]);
12
+ return Promise.resolve([moves[Math.floor(Math.random() * moves.length)]]);
13
+ };
14
+ Dummy.prototype.getLegalMoves = function (state, player) {
15
+ var rules = new this.Rules(state, { player: player });
16
+ if (rules.getLegalMoves) {
17
+ return rules.getLegalMoves(player);
18
+ }
19
+ else {
20
+ console.error('Dummy player cannot work if getLegalMoves is not implemented!');
21
+ return [];
22
+ }
23
+ };
24
+ return Dummy;
25
+ }());
26
+ exports.Dummy = Dummy;
27
27
  //# sourceMappingURL=Dummy.js.map
package/dist/Dummy.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"Dummy.js","sourceRoot":"","sources":["../src/Dummy.ts"],"names":[],"mappings":";;;AAEA;IAIE,eAAY,KAAyC;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,6BAAa,GAAb,UAAc,KAAW,EAAE,QAAkB;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAC/C,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC7C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3E,CAAC;IAED,6BAAa,GAAb,UAAc,KAAW,EAAE,MAAgB;QACzC,IAAM,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAA;QAC/C,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;SACnC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,OAAO,EAAE,CAAA;SACV;IACH,CAAC;IACH,YAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,sBAAK"}
1
+ {"version":3,"file":"Dummy.js","sourceRoot":"","sources":["../src/Dummy.ts"],"names":[],"mappings":";;;AAEA;IAIE,eAAY,KAAyC;QACnD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,6BAAa,GAAb,UAAc,KAAW,EAAE,QAAkB;QAC3C,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAC/C,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC7C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3E,CAAC;IAED,6BAAa,GAAb,UAAc,KAAW,EAAE,MAAgB;QACzC,IAAM,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,EAAE,MAAM,QAAA,EAAE,CAAC,CAAA;QAC/C,IAAI,KAAK,CAAC,aAAa,EAAE,CAAC;YACxB,OAAO,KAAK,CAAC,aAAa,CAAC,MAAM,CAAC,CAAA;QACpC,CAAC;aAAM,CAAC;YACN,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,OAAO,EAAE,CAAA;QACX,CAAC;IACH,CAAC;IACH,YAAC;AAAD,CAAC,AAvBD,IAuBC;AAvBY,sBAAK"}
@@ -1,5 +1,5 @@
1
- export interface Eliminations<Move = string, PlayerId = number> {
2
- isEliminated(playerId: PlayerId): boolean;
3
- giveUpMove?(playerId: PlayerId): Move | undefined;
4
- }
5
- export declare function hasEliminations<Move, PlayerId>(rules: Object): rules is Eliminations<Move, PlayerId>;
1
+ export interface Eliminations<Move = string, PlayerId = number> {
2
+ isEliminated(playerId: PlayerId): boolean;
3
+ giveUpMove?(playerId: PlayerId): Move | undefined;
4
+ }
5
+ export declare function hasEliminations<Move, PlayerId>(rules: Object): rules is Eliminations<Move, PlayerId>;
@@ -1,9 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.hasEliminations = void 0;
4
- function hasEliminations(rules) {
5
- var test = rules;
6
- return typeof test.isEliminated === 'function';
7
- }
8
- exports.hasEliminations = hasEliminations;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.hasEliminations = void 0;
4
+ function hasEliminations(rules) {
5
+ var test = rules;
6
+ return typeof test.isEliminated === 'function';
7
+ }
8
+ exports.hasEliminations = hasEliminations;
9
9
  //# sourceMappingURL=Eliminations.js.map
@@ -1,3 +1,3 @@
1
- export interface GameSetup<Game = any, Options = any> {
2
- setup(options: Options): Game;
3
- }
1
+ export interface GameSetup<Game = any, Options = any> {
2
+ setup(options: Options): Game;
3
+ }
package/dist/GameSetup.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=GameSetup.js.map
@@ -1,4 +1,4 @@
1
- import { GameSetup } from './GameSetup';
2
- export interface GameSetupCreator<Game = any, Options = any> {
3
- new (): GameSetup<Game, Options>;
4
- }
1
+ import { GameSetup } from './GameSetup';
2
+ export interface GameSetupCreator<Game = any, Options = any> {
3
+ new (): GameSetup<Game, Options>;
4
+ }
@@ -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=GameSetupCreator.js.map
@@ -1,14 +1,14 @@
1
- import { Rules } from './Rules';
2
- export interface IncompleteInformation<GameView = any, Move = any, MoveView = any> {
3
- getView(): GameView;
4
- getMoveView(move: Move): MoveView;
5
- }
6
- export declare function hasIncompleteInformation<GameView = any, Move = any, MoveView = any>(rules: Object): rules is IncompleteInformation<GameView, Move, MoveView>;
7
- export interface SecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any> extends IncompleteInformation<GameView, Move, MoveView> {
8
- getPlayerView(playerId: PlayerId): GameView;
9
- getPlayerMoveView?(move: Move, playerId: PlayerId): MoveView;
10
- keepMoveSecret?(move: Move, playerId: PlayerId): boolean;
11
- }
12
- export declare function hasSecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any>(rules: Object): rules is SecretInformation<GameView, Move, MoveView, PlayerId>;
13
- export declare function getGameView<Game, GameView, PlayerId>(rules: Rules<Game, any, PlayerId>, playerId?: PlayerId): GameView;
14
- export declare function getMoveView<GameView, Move, MoveView, PlayerId>(rules: Rules<any, Move, PlayerId>, move: Move, playerId?: PlayerId): MoveView;
1
+ import { Rules } from './Rules';
2
+ export interface IncompleteInformation<GameView = any, Move = any, MoveView = any> {
3
+ getView(): GameView;
4
+ getMoveView(move: Move): MoveView;
5
+ }
6
+ export declare function hasIncompleteInformation<GameView = any, Move = any, MoveView = any>(rules: Object): rules is IncompleteInformation<GameView, Move, MoveView>;
7
+ export interface SecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any> extends IncompleteInformation<GameView, Move, MoveView> {
8
+ getPlayerView(playerId: PlayerId): GameView;
9
+ getPlayerMoveView?(move: Move, playerId: PlayerId): MoveView;
10
+ keepMoveSecret?(move: Move, playerId: PlayerId): boolean;
11
+ }
12
+ export declare function hasSecretInformation<GameView = any, Move = any, MoveView = any, PlayerId = any>(rules: Object): rules is SecretInformation<GameView, Move, MoveView, PlayerId>;
13
+ export declare function getGameView<Game, GameView, PlayerId>(rules: Rules<Game, any, PlayerId>, playerId?: PlayerId): GameView;
14
+ export declare function getMoveView<GameView, Move, MoveView, PlayerId>(rules: Rules<any, Move, PlayerId>, move: Move, playerId?: PlayerId): MoveView;