@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.
- package/dist/Action.d.ts +25 -25
- package/dist/Action.js +61 -61
- package/dist/Action.js.map +1 -1
- package/dist/ApplyAutomaticMoves.d.ts +2 -2
- package/dist/ApplyAutomaticMoves.js +24 -24
- package/dist/ApplyAutomaticMoves.js.map +1 -1
- package/dist/Competitive.d.ts +13 -13
- package/dist/Competitive.js +45 -45
- package/dist/Competitive.js.map +1 -1
- package/dist/DefaultGameSetup.d.ts +7 -7
- package/dist/DefaultGameSetup.js +14 -14
- package/dist/Dummy.d.ts +7 -7
- package/dist/Dummy.js +26 -26
- package/dist/Dummy.js.map +1 -1
- package/dist/Eliminations.d.ts +5 -5
- package/dist/Eliminations.js +8 -8
- package/dist/GameSetup.d.ts +3 -3
- package/dist/GameSetup.js +2 -2
- package/dist/GameSetupCreator.d.ts +4 -4
- package/dist/GameSetupCreator.js +2 -2
- package/dist/IncompleteInformation.d.ts +14 -14
- package/dist/IncompleteInformation.js +37 -37
- package/dist/IncompleteInformation.js.map +1 -1
- package/dist/LocalMovePreview.d.ts +4 -0
- package/dist/LocalMovePreview.js +8 -0
- package/dist/LocalMovePreview.js.map +1 -0
- package/dist/LoopWithFuse.d.ts +4 -4
- package/dist/LoopWithFuse.js +14 -14
- package/dist/LoopWithFuse.js.map +1 -1
- package/dist/RandomMove.d.ts +7 -7
- package/dist/RandomMove.js +14 -14
- package/dist/Robot.d.ts +1 -1
- package/dist/Robot.js +2 -2
- package/dist/Rules.d.ts +18 -17
- package/dist/Rules.js +78 -78
- package/dist/Rules.js.map +1 -1
- package/dist/RulesCreator.d.ts +7 -7
- package/dist/RulesCreator.js +2 -2
- package/dist/TimeLimit.d.ts +10 -10
- package/dist/TimeLimit.js +12 -12
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.d.ts +6 -6
- package/dist/Undo.js +8 -8
- package/dist/UnpredictableMove.d.ts +5 -5
- package/dist/UnpredictableMove.js +5 -5
- package/dist/index.d.ts +21 -20
- package/dist/index.js +37 -36
- package/dist/index.js.map +1 -1
- package/dist/material/HiddenMaterialRules.d.ts +36 -35
- package/dist/material/HiddenMaterialRules.js +245 -245
- package/dist/material/HiddenMaterialRules.js.map +1 -1
- package/dist/material/MaterialGame.d.ts +15 -15
- package/dist/material/MaterialGame.js +2 -2
- package/dist/material/MaterialGameSetup.d.ts +21 -21
- package/dist/material/MaterialGameSetup.js +75 -75
- package/dist/material/MaterialGameSetup.js.map +1 -1
- package/dist/material/MaterialRules.d.ts +44 -44
- package/dist/material/MaterialRules.js +242 -242
- package/dist/material/MaterialRules.js.map +1 -1
- package/dist/material/SecretMaterialRules.d.ts +13 -13
- package/dist/material/SecretMaterialRules.js +37 -37
- package/dist/material/index.d.ts +10 -10
- package/dist/material/index.js +26 -26
- package/dist/material/items/Material.d.ts +59 -57
- package/dist/material/items/Material.js +406 -376
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialItem.d.ts +7 -7
- package/dist/material/items/MaterialItem.js +2 -2
- package/dist/material/items/MaterialMutator.d.ts +31 -31
- package/dist/material/items/MaterialMutator.js +277 -272
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.d.ts +3 -3
- package/dist/material/items/index.js +19 -19
- package/dist/material/location/Location.d.ts +11 -11
- package/dist/material/location/Location.js +2 -2
- package/dist/material/location/LocationBuilder.d.ts +12 -12
- package/dist/material/location/LocationBuilder.js +40 -40
- package/dist/material/location/index.d.ts +3 -3
- package/dist/material/location/index.js +19 -19
- package/dist/material/location/strategy/FillGapStrategy.d.ts +7 -7
- package/dist/material/location/strategy/FillGapStrategy.js +23 -23
- package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
- package/dist/material/location/strategy/LocationStrategy.d.ts +6 -6
- package/dist/material/location/strategy/LocationStrategy.js +2 -2
- package/dist/material/location/strategy/PositiveSequenceStrategy.d.ts +9 -9
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +65 -65
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
- package/dist/material/location/strategy/index.d.ts +3 -3
- package/dist/material/location/strategy/index.js +19 -19
- package/dist/material/memory/GameMemory.d.ts +8 -8
- package/dist/material/memory/GameMemory.js +27 -27
- package/dist/material/memory/GameMemory.js.map +1 -1
- package/dist/material/memory/PlayerMemory.d.ts +9 -9
- package/dist/material/memory/PlayerMemory.js +32 -32
- package/dist/material/memory/PlayerMemory.js.map +1 -1
- package/dist/material/memory/index.d.ts +2 -2
- package/dist/material/memory/index.js +18 -18
- package/dist/material/moves/CustomMove.d.ts +9 -9
- package/dist/material/moves/CustomMove.js +10 -10
- package/dist/material/moves/MaterialMove.d.ts +7 -7
- package/dist/material/moves/MaterialMove.js +2 -2
- package/dist/material/moves/MoveKind.d.ts +6 -6
- package/dist/material/moves/MoveKind.js +10 -10
- package/dist/material/moves/MoveKind.js.map +1 -1
- package/dist/material/moves/index.d.ts +6 -6
- package/dist/material/moves/index.js +22 -22
- package/dist/material/moves/items/CreateItem.d.ts +10 -10
- package/dist/material/moves/items/CreateItem.js +15 -15
- package/dist/material/moves/items/CreateItemsAtOnce.d.ts +10 -10
- package/dist/material/moves/items/CreateItemsAtOnce.js +15 -15
- package/dist/material/moves/items/DeleteItem.d.ts +10 -10
- package/dist/material/moves/items/DeleteItem.js +15 -15
- package/dist/material/moves/items/DeleteItemsAtOnce.d.ts +9 -9
- package/dist/material/moves/items/DeleteItemsAtOnce.js +15 -15
- package/dist/material/moves/items/ItemMove.d.ts +17 -17
- package/dist/material/moves/items/ItemMove.js +2 -2
- package/dist/material/moves/items/ItemMoveType.d.ts +11 -11
- package/dist/material/moves/items/ItemMoveType.js +15 -15
- package/dist/material/moves/items/ItemMoveType.js.map +1 -1
- package/dist/material/moves/items/ItemMovesBuilder.d.ts +8 -8
- package/dist/material/moves/items/ItemMovesBuilder.js +33 -33
- package/dist/material/moves/items/ItemMovesBuilder.js.map +1 -1
- package/dist/material/moves/items/MoveItem.d.ts +14 -14
- package/dist/material/moves/items/MoveItem.js +15 -15
- package/dist/material/moves/items/MoveItemsAtOnce.d.ts +13 -13
- package/dist/material/moves/items/MoveItemsAtOnce.js +15 -15
- package/dist/material/moves/items/RollItem.d.ts +11 -11
- package/dist/material/moves/items/RollItem.js +15 -15
- package/dist/material/moves/items/SelectItem.d.ts +11 -10
- package/dist/material/moves/items/SelectItem.js +15 -15
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.d.ts +13 -13
- package/dist/material/moves/items/Shuffle.js +19 -19
- package/dist/material/moves/items/index.d.ts +12 -12
- package/dist/material/moves/items/index.js +28 -28
- package/dist/material/moves/local/CloseTutorialPopup.d.ts +8 -8
- package/dist/material/moves/local/CloseTutorialPopup.js +9 -9
- package/dist/material/moves/local/DisplayHelp.d.ts +39 -39
- package/dist/material/moves/local/DisplayHelp.js +29 -29
- package/dist/material/moves/local/DisplayHelp.js.map +1 -1
- package/dist/material/moves/local/DropItem.d.ts +13 -13
- package/dist/material/moves/local/DropItem.js +9 -9
- package/dist/material/moves/local/LocalMove.d.ts +12 -12
- package/dist/material/moves/local/LocalMove.js +11 -11
- package/dist/material/moves/local/LocalMove.js.map +1 -1
- package/dist/material/moves/local/SetTutorialStep.d.ts +9 -9
- package/dist/material/moves/local/SetTutorialStep.js +9 -9
- package/dist/material/moves/local/index.d.ts +5 -5
- package/dist/material/moves/local/index.js +21 -21
- package/dist/material/moves/rules/EndGame.d.ts +6 -6
- package/dist/material/moves/rules/EndGame.js +9 -9
- package/dist/material/moves/rules/EndPlayerTurn.d.ts +7 -7
- package/dist/material/moves/rules/EndPlayerTurn.js +9 -9
- package/dist/material/moves/rules/RuleMove.d.ts +18 -18
- package/dist/material/moves/rules/RuleMove.js +18 -18
- package/dist/material/moves/rules/RuleMove.js.map +1 -1
- package/dist/material/moves/rules/StartPlayerTurn.d.ts +8 -8
- package/dist/material/moves/rules/StartPlayerTurn.js +9 -9
- package/dist/material/moves/rules/StartRule.d.ts +7 -7
- package/dist/material/moves/rules/StartRule.js +9 -9
- package/dist/material/moves/rules/StartSimultaneousRule.d.ts +8 -8
- package/dist/material/moves/rules/StartSimultaneousRule.js +9 -9
- package/dist/material/moves/rules/index.d.ts +6 -6
- package/dist/material/moves/rules/index.js +22 -22
- package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +12 -12
- package/dist/material/rules/MaterialRulesMovesBuilder.js +35 -35
- package/dist/material/rules/MaterialRulesPart.d.ts +23 -23
- package/dist/material/rules/MaterialRulesPart.js +64 -64
- package/dist/material/rules/MaterialRulesPart.js.map +1 -1
- package/dist/material/rules/PlayerTurnRule.d.ts +9 -9
- package/dist/material/rules/PlayerTurnRule.js +52 -52
- package/dist/material/rules/RuleStep.d.ts +5 -5
- package/dist/material/rules/RuleStep.js +2 -2
- package/dist/material/rules/SimultaneousRule.d.ts +9 -9
- package/dist/material/rules/SimultaneousRule.js +41 -41
- package/dist/material/rules/SimultaneousRule.js.map +1 -1
- package/dist/material/rules/index.d.ts +5 -5
- package/dist/material/rules/index.js +21 -21
- package/dist/options/EnumOption.d.ts +6 -6
- package/dist/options/EnumOption.js +7 -7
- package/dist/options/Option.d.ts +8 -8
- package/dist/options/Option.js +2 -2
- package/dist/options/OptionSpecOf.d.ts +5 -5
- package/dist/options/OptionSpecOf.js +2 -2
- package/dist/options/OptionsSpec.d.ts +9 -9
- package/dist/options/OptionsSpec.js +2 -2
- package/dist/options/OptionsValidationError.d.ts +4 -4
- package/dist/options/OptionsValidationError.js +29 -29
- package/dist/options/OptionsValidationError.js.map +1 -1
- package/dist/options/PlayerEnumOption.d.ts +14 -14
- package/dist/options/PlayerEnumOption.js +66 -66
- package/dist/options/PlayerEnumOption.js.map +1 -1
- package/dist/options/PlayersOptionsSpec.d.ts +7 -7
- package/dist/options/PlayersOptionsSpec.js +2 -2
- package/dist/options/WithIdOption.d.ts +3 -3
- package/dist/options/WithIdOption.js +2 -2
- package/dist/options/WithPlayerOptionsSpec.d.ts +6 -6
- package/dist/options/WithPlayerOptionsSpec.js +7 -7
- package/dist/options/WithPlayersOptions.d.ts +3 -3
- package/dist/options/WithPlayersOptions.js +2 -2
- package/dist/options/index.d.ts +11 -11
- package/dist/options/index.js +27 -27
- package/dist/options/isWithPlayerIdOptions.d.ts +4 -4
- package/dist/options/isWithPlayerIdOptions.js +11 -11
- package/dist/utils/EnumUtils.d.ts +1 -1
- package/dist/utils/EnumUtils.js +7 -7
- package/dist/utils/grid.squares.util.d.ts +11 -11
- package/dist/utils/grid.squares.util.js +30 -30
- package/dist/utils/grid.squares.util.js.map +1 -1
- package/dist/utils/grid.util.d.ts +5 -5
- package/dist/utils/grid.util.js +7 -7
- package/dist/utils/index.d.ts +5 -5
- package/dist/utils/index.js +21 -21
- package/dist/utils/isDeadEndMove.util.d.ts +2 -2
- package/dist/utils/isDeadEndMove.util.js +18 -18
- package/dist/utils/listing.util.d.ts +2 -2
- package/dist/utils/listing.util.js +23 -23
- package/dist/utils/listing.util.js.map +1 -1
- package/package.json +34 -33
- package/dist/material/items/MaterialDeck.d.ts +0 -7
- package/dist/material/items/MaterialDeck.js +0 -35
- package/dist/material/items/MaterialDeck.js.map +0 -1
- package/dist/material/moves/items/MoveAtOnce.d.ts +0 -13
- package/dist/material/moves/items/MoveAtOnce.js +0 -16
- package/dist/material/moves/items/MoveAtOnce.js.map +0 -1
- package/dist/material/moves/items/Roll.d.ts +0 -11
- package/dist/material/moves/items/Roll.js +0 -16
- package/dist/material/moves/items/Roll.js.map +0 -1
- package/dist/material/moves/local/DisplayRules.d.ts +0 -32
- package/dist/material/moves/local/DisplayRules.js +0 -25
- package/dist/material/moves/local/DisplayRules.js.map +0 -1
- package/dist/material/moves/rules/StartSimultanousRule.d.ts +0 -10
- package/dist/material/moves/rules/StartSimultanousRule.js +0 -10
- package/dist/material/moves/rules/StartSimultanousRule.js.map +0 -1
- package/dist/options/PlayerIdSpec.d.ts +0 -7
- package/dist/options/PlayerIdSpec.js +0 -18
- package/dist/options/PlayerIdSpec.js.map +0 -1
- package/dist/options/getFallbackPlayerName.d.ts +0 -4
- package/dist/options/getFallbackPlayerName.js +0 -14
- package/dist/options/getFallbackPlayerName.js.map +0 -1
- package/dist/options/providePlayerIds.d.ts +0 -6
- package/dist/options/providePlayerIds.js +0 -36
- 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
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"IncompleteInformation.js","sourceRoot":"","sources":["../src/IncompleteInformation.ts"],"names":[],"mappings":";;;AAQA,SAAgB,wBAAwB,CAA6C,KAAa;IAChG,IAAM,IAAI,GAAG,KAAwD,CAAA;IACrE,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAA;AACrF,CAAC;AAHD,4DAGC;AAUD,SAAgB,oBAAoB,CAA6D,KAAa;IAC5G,IAAM,IAAI,GAAG,KAA8D,CAAA;IAC3E,OAAO,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;AACjD,CAAC;AAHD,oDAGC;AAED,SAAgB,WAAW,CAA2B,KAAiC,EAAE,QAAmB;IAC1G,IAAI,oBAAoB,CAA+B,KAAK,CAAC,IAAI,QAAQ,KAAK,SAAS,EAAE;
|
|
1
|
+
{"version":3,"file":"IncompleteInformation.js","sourceRoot":"","sources":["../src/IncompleteInformation.ts"],"names":[],"mappings":";;;AAQA,SAAgB,wBAAwB,CAA6C,KAAa;IAChG,IAAM,IAAI,GAAG,KAAwD,CAAA;IACrE,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAA;AACrF,CAAC;AAHD,4DAGC;AAUD,SAAgB,oBAAoB,CAA6D,KAAa;IAC5G,IAAM,IAAI,GAAG,KAA8D,CAAA;IAC3E,OAAO,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;AACjD,CAAC;AAHD,oDAGC;AAED,SAAgB,WAAW,CAA2B,KAAiC,EAAE,QAAmB;IAC1G,IAAI,oBAAoB,CAA+B,KAAK,CAAC,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACxF,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;IACtC,CAAC;SAAM,IAAI,wBAAwB,CAAW,KAAK,CAAC,EAAE,CAAC;QACrD,OAAO,KAAK,CAAC,OAAO,EAAE,CAAA;IACxB,CAAC;SAAM,CAAC;QACN,OAAO,KAAK,CAAC,IAAuB,CAAA;IACtC,CAAC;AACH,CAAC;AARD,kCAQC;AAED,SAAgB,WAAW,CAAqC,KAAiC,EAAE,IAAU,EAAE,QAAmB;IAChI,IAAI,oBAAoB,CAAqC,KAAK,CAAC,IAAI,KAAK,CAAC,iBAAiB,IAAI,QAAQ,KAAK,SAAS,EAAE,CAAC;QACzH,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,iBAAiB,CAAC,IAAI,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAA;IAC5E,CAAC;SAAM,IAAI,wBAAwB,CAA2B,KAAK,CAAC,EAAE,CAAC;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,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"}
|
package/dist/LoopWithFuse.d.ts
CHANGED
|
@@ -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;
|
package/dist/LoopWithFuse.js
CHANGED
|
@@ -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
|
package/dist/LoopWithFuse.js.map
CHANGED
|
@@ -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;
|
|
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"}
|
package/dist/RandomMove.d.ts
CHANGED
|
@@ -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)[];
|
package/dist/RandomMove.js
CHANGED
|
@@ -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
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
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;
|
|
1
|
+
{"version":3,"file":"Rules.js","sourceRoot":"","sources":["../src/Rules.ts"],"names":[],"mappings":"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"}
|
package/dist/RulesCreator.d.ts
CHANGED
|
@@ -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
|
+
}
|
package/dist/RulesCreator.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=RulesCreator.js.map
|
package/dist/TimeLimit.d.ts
CHANGED
|
@@ -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
|
|
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
|
package/dist/TimeLimit.js.map
CHANGED
|
@@ -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,
|
|
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 './
|
|
14
|
-
export * from './
|
|
15
|
-
export * from './
|
|
16
|
-
export * from './
|
|
17
|
-
export * from './
|
|
18
|
-
export * from './
|
|
19
|
-
export * from './
|
|
20
|
-
export * from './
|
|
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';
|