@gamepark/rules-api 6.38.5 → 7.0.0-beta.1
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.js +1 -2
- package/dist/Bot.js +15 -37
- package/dist/Bot.js.map +1 -1
- package/dist/Competitive.js +3 -9
- package/dist/Competitive.js.map +1 -1
- package/dist/Eliminations.js +2 -6
- package/dist/Eliminations.js.map +1 -1
- package/dist/GameSetup.js +1 -2
- package/dist/HiddenInformation.js +2 -6
- package/dist/HiddenInformation.js.map +1 -1
- package/dist/LocalMovePreview.js +1 -5
- package/dist/LocalMovePreview.js.map +1 -1
- package/dist/RandomMove.js +1 -2
- package/dist/Rules.js +49 -59
- package/dist/Rules.js.map +1 -1
- package/dist/SecretInformation.d.ts +11 -0
- package/dist/SecretInformation.js +2 -6
- package/dist/SecretInformation.js.map +1 -1
- package/dist/TimeLimit.js +1 -5
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.js +2 -6
- package/dist/Undo.js.map +1 -1
- package/dist/UnpredictableMove.js +1 -5
- package/dist/UnpredictableMove.js.map +1 -1
- package/dist/index.js +16 -32
- package/dist/index.js.map +1 -1
- package/dist/material/HiddenMaterialRules.d.ts +1 -1
- package/dist/material/HiddenMaterialRules.js +125 -189
- package/dist/material/HiddenMaterialRules.js.map +1 -1
- package/dist/material/MaterialGame.js +1 -2
- package/dist/material/MaterialGameSetup.js +52 -70
- package/dist/material/MaterialGameSetup.js.map +1 -1
- package/dist/material/MaterialRules.d.ts +1 -1
- package/dist/material/MaterialRules.js +186 -255
- package/dist/material/MaterialRules.js.map +1 -1
- package/dist/material/SecretMaterialRules.js +9 -35
- package/dist/material/SecretMaterialRules.js.map +1 -1
- package/dist/material/index.js +11 -27
- package/dist/material/index.js.map +1 -1
- package/dist/material/items/Material.js +177 -268
- package/dist/material/items/Material.js.map +1 -1
- package/dist/material/items/MaterialDeck.js +10 -36
- package/dist/material/items/MaterialDeck.js.map +1 -1
- package/dist/material/items/MaterialItem.js +1 -2
- package/dist/material/items/MaterialMoney.js +89 -147
- package/dist/material/items/MaterialMoney.js.map +1 -1
- package/dist/material/items/MaterialMutator.js +108 -149
- package/dist/material/items/MaterialMutator.js.map +1 -1
- package/dist/material/items/index.js +5 -21
- package/dist/material/items/index.js.map +1 -1
- package/dist/material/location/Location.js +1 -14
- package/dist/material/location/Location.js.map +1 -1
- package/dist/material/location/LocationBuilder.js +26 -41
- package/dist/material/location/LocationBuilder.js.map +1 -1
- package/dist/material/location/index.js +3 -19
- package/dist/material/location/index.js.map +1 -1
- package/dist/material/location/strategy/FillGapStrategy.js +9 -16
- package/dist/material/location/strategy/FillGapStrategy.js.map +1 -1
- package/dist/material/location/strategy/LocationStrategy.js +1 -2
- package/dist/material/location/strategy/PositiveSequenceStrategy.js +26 -35
- package/dist/material/location/strategy/PositiveSequenceStrategy.js.map +1 -1
- package/dist/material/location/strategy/StackingStrategy.js +15 -22
- package/dist/material/location/strategy/StackingStrategy.js.map +1 -1
- package/dist/material/location/strategy/index.js +5 -23
- package/dist/material/location/strategy/index.js.map +1 -1
- package/dist/material/memory/GameMemory.js +10 -14
- package/dist/material/memory/GameMemory.js.map +1 -1
- package/dist/material/memory/PlayerMemory.js +13 -18
- package/dist/material/memory/PlayerMemory.js.map +1 -1
- package/dist/material/memory/index.js +2 -18
- package/dist/material/memory/index.js.map +1 -1
- package/dist/material/moves/CustomMove.js +4 -9
- package/dist/material/moves/CustomMove.js.map +1 -1
- package/dist/material/moves/MaterialMove.js +1 -2
- package/dist/material/moves/MaterialMoveBuilder.js +16 -32
- package/dist/material/moves/MaterialMoveBuilder.js.map +1 -1
- package/dist/material/moves/MoveKind.js +2 -5
- package/dist/material/moves/MoveKind.js.map +1 -1
- package/dist/material/moves/index.js +7 -23
- package/dist/material/moves/index.js.map +1 -1
- package/dist/material/moves/items/CreateItem.js +6 -13
- package/dist/material/moves/items/CreateItem.js.map +1 -1
- package/dist/material/moves/items/CreateItemsAtOnce.js +6 -13
- package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/DeleteItem.js +6 -13
- package/dist/material/moves/items/DeleteItem.js.map +1 -1
- package/dist/material/moves/items/DeleteItemsAtOnce.js +6 -13
- package/dist/material/moves/items/DeleteItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/ItemMove.js +1 -2
- package/dist/material/moves/items/ItemMoveType.js +2 -5
- package/dist/material/moves/items/ItemMoveType.js.map +1 -1
- package/dist/material/moves/items/MoveItem.js +6 -13
- package/dist/material/moves/items/MoveItem.js.map +1 -1
- package/dist/material/moves/items/MoveItemsAtOnce.js +6 -13
- package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/RollItem.js +6 -13
- package/dist/material/moves/items/RollItem.js.map +1 -1
- package/dist/material/moves/items/SelectItem.js +6 -13
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.js +7 -15
- package/dist/material/moves/items/Shuffle.js.map +1 -1
- package/dist/material/moves/items/index.js +11 -27
- package/dist/material/moves/items/index.js.map +1 -1
- package/dist/material/moves/local/CloseTutorialPopup.js +4 -8
- package/dist/material/moves/local/CloseTutorialPopup.js.map +1 -1
- package/dist/material/moves/local/DisplayHelp.js +2 -5
- package/dist/material/moves/local/DisplayHelp.js.map +1 -1
- package/dist/material/moves/local/DropItem.js +1 -2
- package/dist/material/moves/local/LocalMove.js +2 -5
- package/dist/material/moves/local/LocalMove.js.map +1 -1
- package/dist/material/moves/local/SetTutorialStep.js +4 -8
- package/dist/material/moves/local/SetTutorialStep.js.map +1 -1
- package/dist/material/moves/local/index.js +5 -21
- package/dist/material/moves/local/index.js.map +1 -1
- package/dist/material/moves/rules/EndGame.js +4 -8
- package/dist/material/moves/rules/EndGame.js.map +1 -1
- package/dist/material/moves/rules/EndPlayerTurn.js +4 -8
- package/dist/material/moves/rules/EndPlayerTurn.js.map +1 -1
- package/dist/material/moves/rules/RuleMove.js +3 -7
- package/dist/material/moves/rules/RuleMove.js.map +1 -1
- package/dist/material/moves/rules/StartPlayerTurn.js +4 -8
- package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -1
- package/dist/material/moves/rules/StartRule.js +4 -8
- package/dist/material/moves/rules/StartRule.js.map +1 -1
- package/dist/material/moves/rules/StartSimultaneousRule.js +4 -8
- package/dist/material/moves/rules/StartSimultaneousRule.js.map +1 -1
- package/dist/material/moves/rules/index.js +6 -22
- package/dist/material/moves/rules/index.js.map +1 -1
- package/dist/material/rules/MaterialRulesPart.d.ts +1 -1
- package/dist/material/rules/MaterialRulesPart.js +38 -63
- package/dist/material/rules/MaterialRulesPart.js.map +1 -1
- package/dist/material/rules/PlayerTurnRule.js +20 -52
- package/dist/material/rules/PlayerTurnRule.js.map +1 -1
- package/dist/material/rules/RuleStep.js +1 -2
- package/dist/material/rules/SimultaneousRule.js +19 -51
- package/dist/material/rules/SimultaneousRule.js.map +1 -1
- package/dist/material/rules/index.js +4 -20
- package/dist/material/rules/index.js.map +1 -1
- package/dist/material/tutorial/TutorialState.js +1 -2
- package/dist/material/tutorial/index.js +1 -17
- package/dist/material/tutorial/index.js.map +1 -1
- package/dist/options/EnumArrayOption.js +3 -7
- package/dist/options/EnumArrayOption.js.map +1 -1
- package/dist/options/EnumOption.js +1 -5
- package/dist/options/EnumOption.js.map +1 -1
- package/dist/options/Option.js +1 -2
- package/dist/options/OptionSpecOf.js +1 -2
- package/dist/options/OptionsSpec.js +1 -2
- package/dist/options/OptionsValidationError.js +6 -28
- package/dist/options/OptionsValidationError.js.map +1 -1
- package/dist/options/PlayerEnumOption.js +19 -33
- package/dist/options/PlayerEnumOption.js.map +1 -1
- package/dist/options/PlayersOptionsSpec.js +1 -2
- package/dist/options/WithIdOption.js +1 -2
- package/dist/options/WithPlayerOptionsSpec.js +1 -5
- package/dist/options/WithPlayerOptionsSpec.js.map +1 -1
- package/dist/options/WithPlayersOptions.js +1 -2
- package/dist/options/index.js +12 -28
- package/dist/options/index.js.map +1 -1
- package/dist/options/isWithPlayerIdOptions.js +3 -7
- package/dist/options/isWithPlayerIdOptions.js.map +1 -1
- package/dist/utils/action-view.util.js +18 -26
- package/dist/utils/action-view.util.js.map +1 -1
- package/dist/utils/action.util.js +11 -17
- package/dist/utils/action.util.js.map +1 -1
- package/dist/utils/adjacent-groups.util.js +33 -42
- package/dist/utils/adjacent-groups.util.js.map +1 -1
- package/dist/utils/automatic-moves.util.js +10 -16
- package/dist/utils/automatic-moves.util.js.map +1 -1
- package/dist/utils/enum.util.js +7 -14
- package/dist/utils/enum.util.js.map +1 -1
- package/dist/utils/game-view.util.js +5 -9
- package/dist/utils/game-view.util.js.map +1 -1
- package/dist/utils/grid.hex.util.js +36 -88
- package/dist/utils/grid.hex.util.js.map +1 -1
- package/dist/utils/grid.squares.util.js +8 -19
- package/dist/utils/grid.squares.util.js.map +1 -1
- package/dist/utils/grid.util.js +1 -5
- package/dist/utils/grid.util.js.map +1 -1
- package/dist/utils/index.js +16 -32
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/listing.util.js +8 -14
- package/dist/utils/listing.util.js.map +1 -1
- package/dist/utils/loops.util.js +3 -7
- package/dist/utils/loops.util.js.map +1 -1
- package/dist/utils/money.util.js +54 -79
- package/dist/utils/money.util.js.map +1 -1
- package/dist/utils/neighbors.util.js +6 -11
- package/dist/utils/neighbors.util.js.map +1 -1
- package/dist/utils/polyhex.util.js +36 -56
- package/dist/utils/polyhex.util.js.map +1 -1
- package/dist/utils/random.util.js +2 -6
- package/dist/utils/random.util.js.map +1 -1
- package/dist/utils/rank.util.js +9 -13
- package/dist/utils/rank.util.js.map +1 -1
- package/package.json +38 -38
- package/dist/ApplyAutomaticMoves.d.ts +0 -2
- package/dist/ApplyAutomaticMoves.js +0 -25
- package/dist/ApplyAutomaticMoves.js.map +0 -1
- package/dist/DefaultGameSetup.d.ts +0 -7
- package/dist/DefaultGameSetup.js +0 -15
- package/dist/DefaultGameSetup.js.map +0 -1
- package/dist/Dummy.d.ts +0 -7
- package/dist/Dummy.js +0 -27
- package/dist/Dummy.js.map +0 -1
- package/dist/GameSetupCreator.d.ts +0 -4
- package/dist/GameSetupCreator.js +0 -3
- package/dist/GameSetupCreator.js.map +0 -1
- package/dist/IncompleteInformation.d.ts +0 -14
- package/dist/IncompleteInformation.js +0 -38
- package/dist/IncompleteInformation.js.map +0 -1
- package/dist/LoopWithFuse.d.ts +0 -4
- package/dist/LoopWithFuse.js +0 -15
- package/dist/LoopWithFuse.js.map +0 -1
- package/dist/Robot.d.ts +0 -1
- package/dist/Robot.js +0 -3
- package/dist/Robot.js.map +0 -1
- package/dist/RulesCreator.d.ts +0 -7
- package/dist/RulesCreator.js +0 -3
- package/dist/RulesCreator.js.map +0 -1
- package/dist/material/location/strategy/StakingStrategy.d.ts +0 -12
- package/dist/material/location/strategy/StakingStrategy.js +0 -32
- package/dist/material/location/strategy/StakingStrategy.js.map +0 -1
- package/dist/material/moves/items/ItemMovesBuilder.d.ts +0 -8
- package/dist/material/moves/items/ItemMovesBuilder.js +0 -34
- package/dist/material/moves/items/ItemMovesBuilder.js.map +0 -1
- package/dist/material/rules/MaterialMoveBuilder.d.ts +0 -9
- package/dist/material/rules/MaterialMoveBuilder.js +0 -28
- package/dist/material/rules/MaterialMoveBuilder.js.map +0 -1
- package/dist/material/rules/MaterialRulesMovesBuilder.d.ts +0 -12
- package/dist/material/rules/MaterialRulesMovesBuilder.js +0 -36
- package/dist/material/rules/MaterialRulesMovesBuilder.js.map +0 -1
- package/dist/setup/DefaultGameSetup.d.ts +0 -7
- package/dist/setup/DefaultGameSetup.js +0 -15
- package/dist/setup/DefaultGameSetup.js.map +0 -1
- package/dist/setup/GameSetup.d.ts +0 -3
- package/dist/setup/GameSetup.js +0 -3
- package/dist/setup/GameSetup.js.map +0 -1
- package/dist/setup/GameSetupCreator.d.ts +0 -4
- package/dist/setup/GameSetupCreator.js +0 -3
- package/dist/setup/GameSetupCreator.js.map +0 -1
- package/dist/setup/index.d.ts +0 -2
- package/dist/setup/index.js +0 -19
- package/dist/setup/index.js.map +0 -1
- package/dist/utils/EnumUtils.d.ts +0 -1
- package/dist/utils/EnumUtils.js +0 -8
- package/dist/utils/EnumUtils.js.map +0 -1
- package/dist/utils/coordinates.util.d.ts +0 -5
- package/dist/utils/coordinates.util.js +0 -16
- package/dist/utils/coordinates.util.js.map +0 -1
- package/dist/utils/isDeadEndMove.util.d.ts +0 -2
- package/dist/utils/isDeadEndMove.util.js +0 -19
- package/dist/utils/isDeadEndMove.util.js.map +0 -1
package/dist/Action.js
CHANGED
package/dist/Bot.js
CHANGED
|
@@ -1,46 +1,26 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
-
exports.RandomBot = exports.Bot = void 0;
|
|
19
1
|
/**
|
|
20
2
|
* A Bot is a player controlled by a machine for a game.
|
|
21
3
|
* Used to replace players that quit a game, or for opponents in tutorials.
|
|
22
4
|
* Could be used to create AI players.
|
|
23
5
|
*/
|
|
24
|
-
|
|
25
|
-
|
|
6
|
+
export class Bot {
|
|
7
|
+
player;
|
|
8
|
+
constructor(player) {
|
|
26
9
|
this.player = player;
|
|
27
10
|
}
|
|
28
|
-
|
|
29
|
-
}());
|
|
30
|
-
exports.Bot = Bot;
|
|
11
|
+
}
|
|
31
12
|
/**
|
|
32
13
|
* A random bot picks a random move to play amongst all the legal moves.
|
|
33
14
|
* Most board games can list efficiently all the legal moves all the time, which allows to have random bot to replace any missing opponent.
|
|
34
15
|
*/
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
return _this;
|
|
16
|
+
export class RandomBot extends Bot {
|
|
17
|
+
Rules;
|
|
18
|
+
constructor(Rules, player) {
|
|
19
|
+
super(player);
|
|
20
|
+
this.Rules = Rules;
|
|
41
21
|
}
|
|
42
|
-
|
|
43
|
-
|
|
22
|
+
run(game) {
|
|
23
|
+
const moves = this.getLegalMoves(game);
|
|
44
24
|
switch (moves.length) {
|
|
45
25
|
case 0:
|
|
46
26
|
console.warn('Random bot requires at least one legal move from getLegalMoves to run');
|
|
@@ -50,7 +30,7 @@ var RandomBot = /** @class */ (function (_super) {
|
|
|
50
30
|
default:
|
|
51
31
|
return [moves[Math.floor(Math.random() * moves.length)]];
|
|
52
32
|
}
|
|
53
|
-
}
|
|
33
|
+
}
|
|
54
34
|
/**
|
|
55
35
|
* The legal moves for this player at this game state.
|
|
56
36
|
* Can be overridden if you need to further restrict the moves you want the bot to play.
|
|
@@ -58,10 +38,8 @@ var RandomBot = /** @class */ (function (_super) {
|
|
|
58
38
|
* @param game The game state
|
|
59
39
|
* @protected
|
|
60
40
|
*/
|
|
61
|
-
|
|
41
|
+
getLegalMoves(game) {
|
|
62
42
|
return new this.Rules(game).getLegalMoves(this.player);
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
}(Bot));
|
|
66
|
-
exports.RandomBot = RandomBot;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
67
45
|
//# sourceMappingURL=Bot.js.map
|
package/dist/Bot.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Bot.js","sourceRoot":"","sources":["../src/Bot.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Bot.js","sourceRoot":"","sources":["../src/Bot.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AACH,MAAM,OAAgB,GAAG;IACS;IAAhC,YAAgC,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAC9C,CAAC;CAQF;AAED;;;GAGG;AACH,MAAM,OAAO,SAAgD,SAAQ,GAAG;IAClD;IAApB,YAAoB,KAAuC,EAAE,MAAc;QACzE,KAAK,CAAC,MAAM,CAAC,CAAA;QADK,UAAK,GAAL,KAAK,CAAkC;IAE3D,CAAC;IAED,GAAG,CAAC,IAAU;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,IAAI,CAAC,CAAA;QACtC,QAAQ,KAAK,CAAC,MAAM,EAAE,CAAC;YACrB,KAAK,CAAC;gBACJ,OAAO,CAAC,IAAI,CAAC,uEAAuE,CAAC,CAAA;gBACrF,OAAO,EAAE,CAAA;YACX,KAAK,CAAC;gBACJ,OAAO,KAAK,CAAA;YACd;gBACE,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAA;QAC5D,CAAC;IACH,CAAC;IAED;;;;;;OAMG;IACO,aAAa,CAAC,IAAU;QAChC,OAAO,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAA;IACxD,CAAC;CACF"}
|
package/dist/Competitive.js
CHANGED
|
@@ -1,31 +1,25 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCompetitiveRank = exports.isCompetitiveScore = exports.isCompetitive = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard to identify if a game's Rule is Competitive or not.
|
|
6
3
|
* @param rules game's Rule
|
|
7
4
|
* @returns true if the game is competitive
|
|
8
5
|
*/
|
|
9
|
-
function isCompetitive(rules) {
|
|
6
|
+
export function isCompetitive(rules) {
|
|
10
7
|
return isCompetitiveScore(rules) || isCompetitiveRank(rules);
|
|
11
8
|
}
|
|
12
|
-
exports.isCompetitive = isCompetitive;
|
|
13
9
|
/**
|
|
14
10
|
* Type guard to identify if a game's Rule provide scores for players.
|
|
15
11
|
* @param rules game's Rule
|
|
16
12
|
* @returns true if the game is competitive with scores
|
|
17
13
|
*/
|
|
18
|
-
function isCompetitiveScore(rules) {
|
|
14
|
+
export function isCompetitiveScore(rules) {
|
|
19
15
|
return typeof rules.getScore === 'function';
|
|
20
16
|
}
|
|
21
|
-
exports.isCompetitiveScore = isCompetitiveScore;
|
|
22
17
|
/**
|
|
23
18
|
* Type guard to identify if a game's Rule can rank the players.
|
|
24
19
|
* @param rules game's Rule
|
|
25
20
|
* @returns true if the game is competitive with ranking (used when scores are not available)
|
|
26
21
|
*/
|
|
27
|
-
function isCompetitiveRank(rules) {
|
|
22
|
+
export function isCompetitiveRank(rules) {
|
|
28
23
|
return typeof rules.rankPlayers === 'function';
|
|
29
24
|
}
|
|
30
|
-
exports.isCompetitiveRank = isCompetitiveRank;
|
|
31
25
|
//# sourceMappingURL=Competitive.js.map
|
package/dist/Competitive.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Competitive.js","sourceRoot":"","sources":["../src/Competitive.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Competitive.js","sourceRoot":"","sources":["../src/Competitive.ts"],"names":[],"mappings":"AA8CA;;;;GAIG;AACH,MAAM,UAAU,aAAa,CAAuB,KAAgC;IAClF,OAAO,kBAAkB,CAAC,KAAK,CAAC,IAAI,iBAAiB,CAAC,KAAK,CAAC,CAAA;AAC9D,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB,CAAuB,KAAgC;IACvF,OAAO,OAAQ,KAAgD,CAAC,QAAQ,KAAK,UAAU,CAAA;AACzF,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,iBAAiB,CAAuB,KAAgC;IACtF,OAAO,OAAQ,KAA+C,CAAC,WAAW,KAAK,UAAU,CAAA;AAC3F,CAAC"}
|
package/dist/Eliminations.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasEliminations = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for {@link Eliminations} interface
|
|
6
3
|
* @param rules Rules of a game
|
|
7
4
|
* @returns true if the Rules implements {@link Eliminations}
|
|
8
5
|
*/
|
|
9
|
-
function hasEliminations(rules) {
|
|
10
|
-
|
|
6
|
+
export function hasEliminations(rules) {
|
|
7
|
+
const test = rules;
|
|
11
8
|
return typeof test.isEliminated === 'function';
|
|
12
9
|
}
|
|
13
|
-
exports.hasEliminations = hasEliminations;
|
|
14
10
|
//# sourceMappingURL=Eliminations.js.map
|
package/dist/Eliminations.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Eliminations.js","sourceRoot":"","sources":["../src/Eliminations.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Eliminations.js","sourceRoot":"","sources":["../src/Eliminations.ts"],"names":[],"mappings":"AAkBA;;;;GAIG;AACH,MAAM,UAAU,eAAe,CAAiB,KAAa;IAC3D,MAAM,IAAI,GAAG,KAAqC,CAAA;IAClD,OAAO,OAAO,IAAI,CAAC,YAAY,KAAK,UAAU,CAAA;AAChD,CAAC"}
|
package/dist/GameSetup.js
CHANGED
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasHiddenInformation = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for games with hidden information
|
|
6
3
|
* @param rules Rules of the game
|
|
7
4
|
* @returns true if the game implements {@link HiddenInformation}
|
|
8
5
|
*/
|
|
9
|
-
function hasHiddenInformation(rules) {
|
|
10
|
-
|
|
6
|
+
export function hasHiddenInformation(rules) {
|
|
7
|
+
const test = rules;
|
|
11
8
|
return typeof test.getView === 'function' && typeof test.getMoveView === 'function';
|
|
12
9
|
}
|
|
13
|
-
exports.hasHiddenInformation = hasHiddenInformation;
|
|
14
10
|
//# sourceMappingURL=HiddenInformation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"HiddenInformation.js","sourceRoot":"","sources":["../src/HiddenInformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"HiddenInformation.js","sourceRoot":"","sources":["../src/HiddenInformation.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAA6C,KAAa;IAC5F,MAAM,IAAI,GAAG,KAAoD,CAAA;IACjE,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,IAAI,OAAO,IAAI,CAAC,WAAW,KAAK,UAAU,CAAA;AACrF,CAAC"}
|
package/dist/LocalMovePreview.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasLocalMovePreview = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for {@link LocalMovePreview} interface
|
|
6
3
|
* @param rules The game's rules
|
|
7
4
|
* @return true if the rules implements {@link LocalMovePreview}
|
|
8
5
|
*/
|
|
9
|
-
function hasLocalMovePreview(rules) {
|
|
6
|
+
export function hasLocalMovePreview(rules) {
|
|
10
7
|
return typeof rules.previewMove === 'function';
|
|
11
8
|
}
|
|
12
|
-
exports.hasLocalMovePreview = hasLocalMovePreview;
|
|
13
9
|
//# sourceMappingURL=LocalMovePreview.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LocalMovePreview.js","sourceRoot":"","sources":["../src/LocalMovePreview.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"LocalMovePreview.js","sourceRoot":"","sources":["../src/LocalMovePreview.ts"],"names":[],"mappings":"AAaA;;;;GAIG;AACH,MAAM,UAAU,mBAAmB,CAAa,KAAa;IAC3D,OAAO,OAAQ,KAAgC,CAAC,WAAW,KAAK,UAAU,CAAA;AAC5E,CAAC"}
|
package/dist/RandomMove.js
CHANGED
package/dist/Rules.js
CHANGED
|
@@ -1,11 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Rules = void 0;
|
|
7
|
-
var isEqual_1 = __importDefault(require("lodash/isEqual"));
|
|
8
|
-
var Eliminations_1 = require("./Eliminations");
|
|
1
|
+
import { isEqual } from 'es-toolkit';
|
|
2
|
+
import { hasEliminations } from './Eliminations';
|
|
9
3
|
/**
|
|
10
4
|
* The Rules class is the basic minimal API to implement when adapting a board game on Game Park.
|
|
11
5
|
* It has the ability to tell whether it is a player's turn to play, what moves are legal, what happens when a move is played, and when the game is over.
|
|
@@ -14,33 +8,33 @@ var Eliminations_1 = require("./Eliminations");
|
|
|
14
8
|
* @typeparam Move - Data structure of a game move
|
|
15
9
|
* @typeparam PlayerId - type of the player's identifiers. Usually a number or a numeric enum.
|
|
16
10
|
*/
|
|
17
|
-
|
|
11
|
+
export class Rules {
|
|
12
|
+
/**
|
|
13
|
+
* The state of the game
|
|
14
|
+
*/
|
|
15
|
+
game;
|
|
18
16
|
/**
|
|
19
17
|
* Construct a new instance of the Rules to work on a game state
|
|
20
18
|
* @param game the state of the game to work on
|
|
21
19
|
*/
|
|
22
|
-
|
|
20
|
+
constructor(game) {
|
|
23
21
|
this.game = game;
|
|
24
22
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
},
|
|
32
|
-
enumerable: false,
|
|
33
|
-
configurable: true
|
|
34
|
-
});
|
|
23
|
+
/**
|
|
24
|
+
* A shortcut for this.game for backward compatibility
|
|
25
|
+
*/
|
|
26
|
+
get state() {
|
|
27
|
+
return this.game;
|
|
28
|
+
}
|
|
35
29
|
/**
|
|
36
30
|
* The delegation allows to split the rules in smaller and simpler parts.
|
|
37
31
|
* Override this method to delegate the behavior of the other method to another Rules class.
|
|
38
32
|
*
|
|
39
33
|
* @return the Rule you want to delegate the current game behavior to
|
|
40
34
|
*/
|
|
41
|
-
|
|
35
|
+
delegate() {
|
|
42
36
|
return;
|
|
43
|
-
}
|
|
37
|
+
}
|
|
44
38
|
/**
|
|
45
39
|
* The delegation allows to split the rules in smaller and simpler parts.
|
|
46
40
|
* Default behavior call {@link delegate} and returns either an empty array, or an array with the delegate if any.
|
|
@@ -48,10 +42,10 @@ var Rules = /** @class */ (function () {
|
|
|
48
42
|
*
|
|
49
43
|
* @return an array of Rules to delegate the current game behavior to
|
|
50
44
|
*/
|
|
51
|
-
|
|
52
|
-
|
|
45
|
+
delegates() {
|
|
46
|
+
const delegate = this.delegate();
|
|
53
47
|
return delegate ? [delegate] : [];
|
|
54
|
-
}
|
|
48
|
+
}
|
|
55
49
|
/**
|
|
56
50
|
* Implement this to tell at any point in the game which player is active or not.
|
|
57
51
|
* When it's a player's turn, his thinking time decreases.
|
|
@@ -61,28 +55,27 @@ var Rules = /** @class */ (function () {
|
|
|
61
55
|
* @param playerId - Identifier of a player
|
|
62
56
|
* @returns true if it is this player's turn to play
|
|
63
57
|
*/
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
if (rules.some(
|
|
58
|
+
isTurnToPlay(playerId) {
|
|
59
|
+
const rules = this.delegates();
|
|
60
|
+
if (rules.some(rules => rules.isTurnToPlay(playerId))) {
|
|
67
61
|
return true;
|
|
68
62
|
}
|
|
69
63
|
return playerId === this.getActivePlayer();
|
|
70
|
-
}
|
|
64
|
+
}
|
|
71
65
|
/**
|
|
72
66
|
* When only one player is active at a time, you can implement this method instead of "isTurnToPlay" to tell which player is active.
|
|
73
67
|
* Supports delegation: if any {@link delegates} returns an active player, it will return it.
|
|
74
68
|
*
|
|
75
69
|
* @return @typeParam PlayerId - The identifier of the active player
|
|
76
70
|
*/
|
|
77
|
-
|
|
78
|
-
for (
|
|
79
|
-
|
|
80
|
-
var activePlayer = delegate.getActivePlayer();
|
|
71
|
+
getActivePlayer() {
|
|
72
|
+
for (const delegate of this.delegates()) {
|
|
73
|
+
const activePlayer = delegate.getActivePlayer();
|
|
81
74
|
if (activePlayer !== undefined)
|
|
82
75
|
return activePlayer;
|
|
83
76
|
}
|
|
84
77
|
return;
|
|
85
|
-
}
|
|
78
|
+
}
|
|
86
79
|
/**
|
|
87
80
|
* This method allows the Game Park server to authorise only valid moves in accordance with the game rules.
|
|
88
81
|
* The default behavior calls {@link getLegalMoves}, and returns true when at least one move is equal.
|
|
@@ -92,19 +85,19 @@ var Rules = /** @class */ (function () {
|
|
|
92
85
|
* @param move - a Move to control
|
|
93
86
|
* @returns true if the move can be played by this player
|
|
94
87
|
*/
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
if (rules.some(
|
|
88
|
+
isLegalMove(playerId, move) {
|
|
89
|
+
const rules = this.delegates();
|
|
90
|
+
if (rules.some(rules => rules.isLegalMove(playerId, move))) {
|
|
98
91
|
return true;
|
|
99
92
|
}
|
|
100
|
-
if (this.getLegalMoves(playerId).some(
|
|
93
|
+
if (this.getLegalMoves(playerId).some(legalMove => isEqual(move, legalMove))) {
|
|
101
94
|
return true;
|
|
102
95
|
}
|
|
103
|
-
if (
|
|
104
|
-
return (
|
|
96
|
+
if (hasEliminations(this) && this.giveUpMove) {
|
|
97
|
+
return isEqual(move, this.giveUpMove(playerId));
|
|
105
98
|
}
|
|
106
99
|
return false;
|
|
107
|
-
}
|
|
100
|
+
}
|
|
108
101
|
/**
|
|
109
102
|
* This method lists all the moves that are legal for a given player.
|
|
110
103
|
* This is optional but convenient: it is used by {@link isLegalMove}, {@link Bot} and many UI features from @gamepark/react-game to automatically
|
|
@@ -117,9 +110,9 @@ var Rules = /** @class */ (function () {
|
|
|
117
110
|
* @param playerId - Identifier of a player
|
|
118
111
|
* @returns the list of the moves
|
|
119
112
|
*/
|
|
120
|
-
|
|
121
|
-
return this.delegates().flatMap(
|
|
122
|
-
}
|
|
113
|
+
getLegalMoves(playerId) {
|
|
114
|
+
return this.delegates().flatMap(rules => rules.getLegalMoves(playerId));
|
|
115
|
+
}
|
|
123
116
|
/**
|
|
124
117
|
* When some game state require automatic actions to be taken by the players, you can return a list of moves to play played automatically.
|
|
125
118
|
* It can be a sequences in the rules where everything is scripted for instance (no choices left for players).
|
|
@@ -128,9 +121,9 @@ var Rules = /** @class */ (function () {
|
|
|
128
121
|
*
|
|
129
122
|
* @returns the list of the moves that must be played automatically
|
|
130
123
|
*/
|
|
131
|
-
|
|
132
|
-
return this.delegates().flatMap(
|
|
133
|
-
}
|
|
124
|
+
getAutomaticMoves() {
|
|
125
|
+
return this.delegates().flatMap(rules => rules.getAutomaticMoves());
|
|
126
|
+
}
|
|
134
127
|
/**
|
|
135
128
|
* Executes a move on current game state.
|
|
136
129
|
* This method is the only one that should mutate the state of the game.
|
|
@@ -148,9 +141,9 @@ var Rules = /** @class */ (function () {
|
|
|
148
141
|
* @param context - context of execution: see {@link PlayMoveContext}
|
|
149
142
|
* @returns A list of moves that should be immediately played as consequences of this move
|
|
150
143
|
*/
|
|
151
|
-
|
|
152
|
-
return this.delegates().flatMap(
|
|
153
|
-
}
|
|
144
|
+
play(move, context) {
|
|
145
|
+
return this.delegates().flatMap(rules => rules.play(move, context));
|
|
146
|
+
}
|
|
154
147
|
/**
|
|
155
148
|
* This method must return true when the game is over.
|
|
156
149
|
*
|
|
@@ -160,18 +153,15 @@ var Rules = /** @class */ (function () {
|
|
|
160
153
|
* @param playerIds - All the player ids in the game. Do not use (deprecated).
|
|
161
154
|
* @returns true if game is over
|
|
162
155
|
*/
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
if (delegates.length > 0 && delegates.every(function (delegate) { return delegate.isOver(playerIds); })) {
|
|
156
|
+
isOver(playerIds) {
|
|
157
|
+
const delegates = this.delegates();
|
|
158
|
+
if (delegates.length > 0 && delegates.every(delegate => delegate.isOver(playerIds))) {
|
|
167
159
|
return true;
|
|
168
160
|
}
|
|
169
161
|
if (playerIds) {
|
|
170
|
-
return !playerIds.some(
|
|
162
|
+
return !playerIds.some(playerId => this.isTurnToPlay(playerId));
|
|
171
163
|
}
|
|
172
164
|
return this.getActivePlayer() === undefined;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
}());
|
|
176
|
-
exports.Rules = Rules;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
177
167
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"Rules.js","sourceRoot":"","sources":["../src/Rules.ts"],"names":[],"mappings":"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"}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Action } from './Action';
|
|
1
2
|
import { HiddenInformation } from './HiddenInformation';
|
|
2
3
|
/**
|
|
3
4
|
* Some game hide information to the player, and the information is not equally accessible by each player.
|
|
@@ -39,6 +40,16 @@ export interface SecretInformation<GameView = any, Move = any, MoveView = any, P
|
|
|
39
40
|
* @return true as long as the move must be kept secret from that player
|
|
40
41
|
*/
|
|
41
42
|
keepMoveSecret?(move: Move, playerId: PlayerId): boolean;
|
|
43
|
+
/**
|
|
44
|
+
* If some actions played must be entirely keep secret to other players, you can implement this function to prevent the action from being transmitted to
|
|
45
|
+
* another player as long as necessary.
|
|
46
|
+
* Useful for game with secret planning for instance.
|
|
47
|
+
*
|
|
48
|
+
* @param action An action played by a player
|
|
49
|
+
* @param playerId Identifier of another player
|
|
50
|
+
* @return true as long as the move must be kept secret from that player
|
|
51
|
+
*/
|
|
52
|
+
keepActionSecret?(action: Action<Move, PlayerId>, playerId: PlayerId): boolean;
|
|
42
53
|
}
|
|
43
54
|
/**
|
|
44
55
|
* Type guard for games with secret information
|
|
@@ -1,14 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSecretInformation = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for games with secret information
|
|
6
3
|
* @param rules Rules of the game
|
|
7
4
|
* @returns true if the game implements {@link SecretInformation}
|
|
8
5
|
*/
|
|
9
|
-
function hasSecretInformation(rules) {
|
|
10
|
-
|
|
6
|
+
export function hasSecretInformation(rules) {
|
|
7
|
+
const test = rules;
|
|
11
8
|
return typeof test.getPlayerView === 'function';
|
|
12
9
|
}
|
|
13
|
-
exports.hasSecretInformation = hasSecretInformation;
|
|
14
10
|
//# sourceMappingURL=SecretInformation.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SecretInformation.js","sourceRoot":"","sources":["../src/SecretInformation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SecretInformation.js","sourceRoot":"","sources":["../src/SecretInformation.ts"],"names":[],"mappings":"AA4DA;;;;GAIG;AACH,MAAM,UAAU,oBAAoB,CAA6D,KAAa;IAC5G,MAAM,IAAI,GAAG,KAA8D,CAAA;IAC3E,OAAO,OAAO,IAAI,CAAC,aAAa,KAAK,UAAU,CAAA;AACjD,CAAC"}
|
package/dist/TimeLimit.js
CHANGED
|
@@ -1,13 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasTimeLimit = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for {@link TimeLimit} interface
|
|
6
3
|
* @param rules Rules of the game
|
|
7
4
|
* @returns true if rules implements {@link TimeLimit}
|
|
8
5
|
*/
|
|
9
|
-
function hasTimeLimit(rules) {
|
|
6
|
+
export function hasTimeLimit(rules) {
|
|
10
7
|
return typeof rules.giveTime === 'function';
|
|
11
8
|
}
|
|
12
|
-
exports.hasTimeLimit = hasTimeLimit;
|
|
13
9
|
//# 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":"
|
|
1
|
+
{"version":3,"file":"TimeLimit.js","sourceRoot":"","sources":["../src/TimeLimit.ts"],"names":[],"mappings":"AAyBA;;;;GAIG;AACH,MAAM,UAAU,YAAY,CAAuB,KAAkC;IACnF,OAAO,OAAQ,KAAyC,CAAC,QAAQ,KAAK,UAAU,CAAA;AAClF,CAAC"}
|
package/dist/Undo.js
CHANGED
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUndo = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard to know if a game implements the Undo feature.
|
|
6
3
|
*
|
|
7
4
|
* @param rules Rules of the game
|
|
8
5
|
* @returns true if rules implements {@link Undo}
|
|
9
6
|
*/
|
|
10
|
-
function hasUndo(rules) {
|
|
11
|
-
|
|
7
|
+
export function hasUndo(rules) {
|
|
8
|
+
const test = rules;
|
|
12
9
|
return typeof test.canUndo === 'function';
|
|
13
10
|
}
|
|
14
|
-
exports.hasUndo = hasUndo;
|
|
15
11
|
//# sourceMappingURL=Undo.js.map
|
package/dist/Undo.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Undo.js","sourceRoot":"","sources":["../src/Undo.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"Undo.js","sourceRoot":"","sources":["../src/Undo.ts"],"names":[],"mappings":"AA0BA;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAuB,KAAa;IACzD,MAAM,IAAI,GAAG,KAAmC,CAAA;IAChD,OAAO,OAAO,IAAI,CAAC,OAAO,KAAK,UAAU,CAAA;AAC3C,CAAC"}
|
|
@@ -1,11 +1,7 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUnpredictableMoves = void 0;
|
|
4
1
|
/**
|
|
5
2
|
* Type guard for {@link UnpredictableMoves} interface
|
|
6
3
|
* @param rules Rules of the game
|
|
7
4
|
* @returns true is rules implements {@link UnpredictableMoves}
|
|
8
5
|
*/
|
|
9
|
-
|
|
10
|
-
exports.hasUnpredictableMoves = hasUnpredictableMoves;
|
|
6
|
+
export const hasUnpredictableMoves = (rules) => typeof rules.isUnpredictableMove === 'function';
|
|
11
7
|
//# sourceMappingURL=UnpredictableMove.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnpredictableMove.js","sourceRoot":"","sources":["../src/UnpredictableMove.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnpredictableMove.js","sourceRoot":"","sources":["../src/UnpredictableMove.ts"],"names":[],"mappings":"AAsBA;;;;GAIG;AACH,MAAM,CAAC,MAAM,qBAAqB,GAAG,CACnC,KAAqB,EAC+B,EAAE,CAAC,OAAO,KAAK,CAAC,mBAAmB,KAAK,UAAU,CAAA"}
|
package/dist/index.js
CHANGED
|
@@ -1,33 +1,17 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
__exportStar(require("./material"), exports);
|
|
18
|
-
__exportStar(require("./options"), exports);
|
|
19
|
-
__exportStar(require("./utils"), exports);
|
|
20
|
-
__exportStar(require("./Action"), exports);
|
|
21
|
-
__exportStar(require("./Bot"), exports);
|
|
22
|
-
__exportStar(require("./Competitive"), exports);
|
|
23
|
-
__exportStar(require("./Eliminations"), exports);
|
|
24
|
-
__exportStar(require("./GameSetup"), exports);
|
|
25
|
-
__exportStar(require("./HiddenInformation"), exports);
|
|
26
|
-
__exportStar(require("./LocalMovePreview"), exports);
|
|
27
|
-
__exportStar(require("./RandomMove"), exports);
|
|
28
|
-
__exportStar(require("./Rules"), exports);
|
|
29
|
-
__exportStar(require("./SecretInformation"), exports);
|
|
30
|
-
__exportStar(require("./TimeLimit"), exports);
|
|
31
|
-
__exportStar(require("./Undo"), exports);
|
|
32
|
-
__exportStar(require("./UnpredictableMove"), exports);
|
|
1
|
+
export * from './material';
|
|
2
|
+
export * from './options';
|
|
3
|
+
export * from './utils';
|
|
4
|
+
export * from './Action';
|
|
5
|
+
export * from './Bot';
|
|
6
|
+
export * from './Competitive';
|
|
7
|
+
export * from './Eliminations';
|
|
8
|
+
export * from './GameSetup';
|
|
9
|
+
export * from './HiddenInformation';
|
|
10
|
+
export * from './LocalMovePreview';
|
|
11
|
+
export * from './RandomMove';
|
|
12
|
+
export * from './Rules';
|
|
13
|
+
export * from './SecretInformation';
|
|
14
|
+
export * from './TimeLimit';
|
|
15
|
+
export * from './Undo';
|
|
16
|
+
export * from './UnpredictableMove';
|
|
33
17
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAA;AAC1B,cAAc,WAAW,CAAA;AACzB,cAAc,SAAS,CAAA;AACvB,cAAc,UAAU,CAAA;AACxB,cAAc,OAAO,CAAA;AACrB,cAAc,eAAe,CAAA;AAC7B,cAAc,gBAAgB,CAAA;AAC9B,cAAc,aAAa,CAAA;AAC3B,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,cAAc,CAAA;AAC5B,cAAc,SAAS,CAAA;AACvB,cAAc,qBAAqB,CAAA;AACnC,cAAc,aAAa,CAAA;AAC3B,cAAc,QAAQ,CAAA;AACtB,cAAc,qBAAqB,CAAA"}
|
|
@@ -13,7 +13,7 @@ import { MaterialMove, MaterialMoveRandomized, MaterialMoveView } from './moves'
|
|
|
13
13
|
export declare abstract class HiddenMaterialRules<P extends number = number, M extends number = number, L extends number = number, R extends number = number> extends MaterialRules<P, M, L, R> implements HiddenInformation<MaterialGame<P, M, L, R>, MaterialMove<P, M, L, R>, MaterialMove<P, M, L, R>> {
|
|
14
14
|
private readonly client?;
|
|
15
15
|
constructor(game: MaterialGame<P, M, L, R>, client?: {
|
|
16
|
-
player?: P
|
|
16
|
+
player?: P;
|
|
17
17
|
} | undefined);
|
|
18
18
|
/**
|
|
19
19
|
* A hiding strategy allows to hide automatically some information about an item when it is at a specific location type.
|