@gamepark/rules-api 7.0.0-beta.0 → 7.0.0-beta.2
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 -8
- package/dist/Competitive.js.map +1 -1
- package/dist/Eliminations.js +2 -5
- package/dist/Eliminations.js.map +1 -1
- package/dist/GameSetup.js +1 -2
- package/dist/HiddenInformation.js +2 -5
- package/dist/HiddenInformation.js.map +1 -1
- package/dist/LocalMovePreview.js +1 -4
- package/dist/LocalMovePreview.js.map +1 -1
- package/dist/RandomMove.js +1 -2
- package/dist/Rules.js +49 -56
- package/dist/Rules.js.map +1 -1
- package/dist/SecretInformation.js +2 -5
- package/dist/SecretInformation.js.map +1 -1
- package/dist/TimeLimit.js +1 -4
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.js +2 -5
- 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.js +125 -180
- 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.js +186 -250
- 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 -262
- 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 -141
- package/dist/material/items/MaterialMoney.js.map +1 -1
- package/dist/material/items/MaterialMutator.js +108 -145
- 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 -12
- package/dist/material/moves/items/CreateItem.js.map +1 -1
- package/dist/material/moves/items/CreateItemsAtOnce.js +6 -12
- package/dist/material/moves/items/CreateItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/DeleteItem.js +6 -12
- package/dist/material/moves/items/DeleteItem.js.map +1 -1
- package/dist/material/moves/items/DeleteItemsAtOnce.js +6 -12
- 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 -12
- package/dist/material/moves/items/MoveItem.js.map +1 -1
- package/dist/material/moves/items/MoveItemsAtOnce.js +6 -12
- package/dist/material/moves/items/MoveItemsAtOnce.js.map +1 -1
- package/dist/material/moves/items/RollItem.js +6 -12
- package/dist/material/moves/items/RollItem.js.map +1 -1
- package/dist/material/moves/items/SelectItem.js +6 -12
- package/dist/material/moves/items/SelectItem.js.map +1 -1
- package/dist/material/moves/items/Shuffle.js +7 -14
- 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 -7
- 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 -7
- 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 -7
- package/dist/material/moves/rules/EndGame.js.map +1 -1
- package/dist/material/moves/rules/EndPlayerTurn.js +4 -7
- 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 -7
- package/dist/material/moves/rules/StartPlayerTurn.js.map +1 -1
- package/dist/material/moves/rules/StartRule.js +4 -7
- package/dist/material/moves/rules/StartRule.js.map +1 -1
- package/dist/material/moves/rules/StartSimultaneousRule.js +4 -7
- 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.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 -6
- package/dist/options/EnumArrayOption.js.map +1 -1
- package/dist/options/EnumOption.js +1 -4
- 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 -29
- 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 -4
- 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 -6
- package/dist/options/isWithPlayerIdOptions.js.map +1 -1
- package/dist/utils/action-view.util.js +18 -25
- package/dist/utils/action-view.util.js.map +1 -1
- package/dist/utils/action.util.js +11 -16
- package/dist/utils/action.util.js.map +1 -1
- package/dist/utils/adjacent-groups.util.js +33 -41
- package/dist/utils/adjacent-groups.util.js.map +1 -1
- package/dist/utils/automatic-moves.util.js +10 -15
- package/dist/utils/automatic-moves.util.js.map +1 -1
- package/dist/utils/enum.util.js +7 -13
- package/dist/utils/enum.util.js.map +1 -1
- package/dist/utils/game-view.util.js +5 -8
- 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 -13
- package/dist/utils/listing.util.js.map +1 -1
- package/dist/utils/loops.util.js +3 -6
- package/dist/utils/loops.util.js.map +1 -1
- package/dist/utils/money.util.js +54 -73
- package/dist/utils/money.util.js.map +1 -1
- package/dist/utils/neighbors.util.js +6 -10
- 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 -5
- 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 +43 -37
- 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,14 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isCompetitive = isCompetitive;
|
|
4
|
-
exports.isCompetitiveScore = isCompetitiveScore;
|
|
5
|
-
exports.isCompetitiveRank = isCompetitiveRank;
|
|
6
1
|
/**
|
|
7
2
|
* Type guard to identify if a game's Rule is Competitive or not.
|
|
8
3
|
* @param rules game's Rule
|
|
9
4
|
* @returns true if the game is competitive
|
|
10
5
|
*/
|
|
11
|
-
function isCompetitive(rules) {
|
|
6
|
+
export function isCompetitive(rules) {
|
|
12
7
|
return isCompetitiveScore(rules) || isCompetitiveRank(rules);
|
|
13
8
|
}
|
|
14
9
|
/**
|
|
@@ -16,7 +11,7 @@ function isCompetitive(rules) {
|
|
|
16
11
|
* @param rules game's Rule
|
|
17
12
|
* @returns true if the game is competitive with scores
|
|
18
13
|
*/
|
|
19
|
-
function isCompetitiveScore(rules) {
|
|
14
|
+
export function isCompetitiveScore(rules) {
|
|
20
15
|
return typeof rules.getScore === 'function';
|
|
21
16
|
}
|
|
22
17
|
/**
|
|
@@ -24,7 +19,7 @@ function isCompetitiveScore(rules) {
|
|
|
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
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,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasEliminations = hasEliminations;
|
|
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
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,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasHiddenInformation = hasHiddenInformation;
|
|
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
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,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasLocalMovePreview = hasLocalMovePreview;
|
|
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
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,8 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
exports.Rules = void 0;
|
|
4
|
-
var es_toolkit_1 = require("es-toolkit");
|
|
5
|
-
var Eliminations_1 = require("./Eliminations");
|
|
1
|
+
import { isEqual } from 'es-toolkit';
|
|
2
|
+
import { hasEliminations } from './Eliminations';
|
|
6
3
|
/**
|
|
7
4
|
* The Rules class is the basic minimal API to implement when adapting a board game on Game Park.
|
|
8
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.
|
|
@@ -11,33 +8,33 @@ var Eliminations_1 = require("./Eliminations");
|
|
|
11
8
|
* @typeparam Move - Data structure of a game move
|
|
12
9
|
* @typeparam PlayerId - type of the player's identifiers. Usually a number or a numeric enum.
|
|
13
10
|
*/
|
|
14
|
-
|
|
11
|
+
export class Rules {
|
|
12
|
+
/**
|
|
13
|
+
* The state of the game
|
|
14
|
+
*/
|
|
15
|
+
game;
|
|
15
16
|
/**
|
|
16
17
|
* Construct a new instance of the Rules to work on a game state
|
|
17
18
|
* @param game the state of the game to work on
|
|
18
19
|
*/
|
|
19
|
-
|
|
20
|
+
constructor(game) {
|
|
20
21
|
this.game = game;
|
|
21
22
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
},
|
|
29
|
-
enumerable: false,
|
|
30
|
-
configurable: true
|
|
31
|
-
});
|
|
23
|
+
/**
|
|
24
|
+
* A shortcut for this.game for backward compatibility
|
|
25
|
+
*/
|
|
26
|
+
get state() {
|
|
27
|
+
return this.game;
|
|
28
|
+
}
|
|
32
29
|
/**
|
|
33
30
|
* The delegation allows to split the rules in smaller and simpler parts.
|
|
34
31
|
* Override this method to delegate the behavior of the other method to another Rules class.
|
|
35
32
|
*
|
|
36
33
|
* @return the Rule you want to delegate the current game behavior to
|
|
37
34
|
*/
|
|
38
|
-
|
|
35
|
+
delegate() {
|
|
39
36
|
return;
|
|
40
|
-
}
|
|
37
|
+
}
|
|
41
38
|
/**
|
|
42
39
|
* The delegation allows to split the rules in smaller and simpler parts.
|
|
43
40
|
* Default behavior call {@link delegate} and returns either an empty array, or an array with the delegate if any.
|
|
@@ -45,10 +42,10 @@ var Rules = /** @class */ (function () {
|
|
|
45
42
|
*
|
|
46
43
|
* @return an array of Rules to delegate the current game behavior to
|
|
47
44
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
45
|
+
delegates() {
|
|
46
|
+
const delegate = this.delegate();
|
|
50
47
|
return delegate ? [delegate] : [];
|
|
51
|
-
}
|
|
48
|
+
}
|
|
52
49
|
/**
|
|
53
50
|
* Implement this to tell at any point in the game which player is active or not.
|
|
54
51
|
* When it's a player's turn, his thinking time decreases.
|
|
@@ -58,28 +55,27 @@ var Rules = /** @class */ (function () {
|
|
|
58
55
|
* @param playerId - Identifier of a player
|
|
59
56
|
* @returns true if it is this player's turn to play
|
|
60
57
|
*/
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
if (rules.some(
|
|
58
|
+
isTurnToPlay(playerId) {
|
|
59
|
+
const rules = this.delegates();
|
|
60
|
+
if (rules.some(rules => rules.isTurnToPlay(playerId))) {
|
|
64
61
|
return true;
|
|
65
62
|
}
|
|
66
63
|
return playerId === this.getActivePlayer();
|
|
67
|
-
}
|
|
64
|
+
}
|
|
68
65
|
/**
|
|
69
66
|
* When only one player is active at a time, you can implement this method instead of "isTurnToPlay" to tell which player is active.
|
|
70
67
|
* Supports delegation: if any {@link delegates} returns an active player, it will return it.
|
|
71
68
|
*
|
|
72
69
|
* @return @typeParam PlayerId - The identifier of the active player
|
|
73
70
|
*/
|
|
74
|
-
|
|
75
|
-
for (
|
|
76
|
-
|
|
77
|
-
var activePlayer = delegate.getActivePlayer();
|
|
71
|
+
getActivePlayer() {
|
|
72
|
+
for (const delegate of this.delegates()) {
|
|
73
|
+
const activePlayer = delegate.getActivePlayer();
|
|
78
74
|
if (activePlayer !== undefined)
|
|
79
75
|
return activePlayer;
|
|
80
76
|
}
|
|
81
77
|
return;
|
|
82
|
-
}
|
|
78
|
+
}
|
|
83
79
|
/**
|
|
84
80
|
* This method allows the Game Park server to authorise only valid moves in accordance with the game rules.
|
|
85
81
|
* The default behavior calls {@link getLegalMoves}, and returns true when at least one move is equal.
|
|
@@ -89,19 +85,19 @@ var Rules = /** @class */ (function () {
|
|
|
89
85
|
* @param move - a Move to control
|
|
90
86
|
* @returns true if the move can be played by this player
|
|
91
87
|
*/
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
if (rules.some(
|
|
88
|
+
isLegalMove(playerId, move) {
|
|
89
|
+
const rules = this.delegates();
|
|
90
|
+
if (rules.some(rules => rules.isLegalMove(playerId, move))) {
|
|
95
91
|
return true;
|
|
96
92
|
}
|
|
97
|
-
if (this.getLegalMoves(playerId).some(
|
|
93
|
+
if (this.getLegalMoves(playerId).some(legalMove => isEqual(move, legalMove))) {
|
|
98
94
|
return true;
|
|
99
95
|
}
|
|
100
|
-
if (
|
|
101
|
-
return
|
|
96
|
+
if (hasEliminations(this) && this.giveUpMove) {
|
|
97
|
+
return isEqual(move, this.giveUpMove(playerId));
|
|
102
98
|
}
|
|
103
99
|
return false;
|
|
104
|
-
}
|
|
100
|
+
}
|
|
105
101
|
/**
|
|
106
102
|
* This method lists all the moves that are legal for a given player.
|
|
107
103
|
* This is optional but convenient: it is used by {@link isLegalMove}, {@link Bot} and many UI features from @gamepark/react-game to automatically
|
|
@@ -114,9 +110,9 @@ var Rules = /** @class */ (function () {
|
|
|
114
110
|
* @param playerId - Identifier of a player
|
|
115
111
|
* @returns the list of the moves
|
|
116
112
|
*/
|
|
117
|
-
|
|
118
|
-
return this.delegates().flatMap(
|
|
119
|
-
}
|
|
113
|
+
getLegalMoves(playerId) {
|
|
114
|
+
return this.delegates().flatMap(rules => rules.getLegalMoves(playerId));
|
|
115
|
+
}
|
|
120
116
|
/**
|
|
121
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.
|
|
122
118
|
* It can be a sequences in the rules where everything is scripted for instance (no choices left for players).
|
|
@@ -125,9 +121,9 @@ var Rules = /** @class */ (function () {
|
|
|
125
121
|
*
|
|
126
122
|
* @returns the list of the moves that must be played automatically
|
|
127
123
|
*/
|
|
128
|
-
|
|
129
|
-
return this.delegates().flatMap(
|
|
130
|
-
}
|
|
124
|
+
getAutomaticMoves() {
|
|
125
|
+
return this.delegates().flatMap(rules => rules.getAutomaticMoves());
|
|
126
|
+
}
|
|
131
127
|
/**
|
|
132
128
|
* Executes a move on current game state.
|
|
133
129
|
* This method is the only one that should mutate the state of the game.
|
|
@@ -145,9 +141,9 @@ var Rules = /** @class */ (function () {
|
|
|
145
141
|
* @param context - context of execution: see {@link PlayMoveContext}
|
|
146
142
|
* @returns A list of moves that should be immediately played as consequences of this move
|
|
147
143
|
*/
|
|
148
|
-
|
|
149
|
-
return this.delegates().flatMap(
|
|
150
|
-
}
|
|
144
|
+
play(move, context) {
|
|
145
|
+
return this.delegates().flatMap(rules => rules.play(move, context));
|
|
146
|
+
}
|
|
151
147
|
/**
|
|
152
148
|
* This method must return true when the game is over.
|
|
153
149
|
*
|
|
@@ -157,18 +153,15 @@ var Rules = /** @class */ (function () {
|
|
|
157
153
|
* @param playerIds - All the player ids in the game. Do not use (deprecated).
|
|
158
154
|
* @returns true if game is over
|
|
159
155
|
*/
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
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))) {
|
|
164
159
|
return true;
|
|
165
160
|
}
|
|
166
161
|
if (playerIds) {
|
|
167
|
-
return !playerIds.some(
|
|
162
|
+
return !playerIds.some(playerId => this.isTurnToPlay(playerId));
|
|
168
163
|
}
|
|
169
164
|
return this.getActivePlayer() === undefined;
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
}());
|
|
173
|
-
exports.Rules = Rules;
|
|
165
|
+
}
|
|
166
|
+
}
|
|
174
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,13 +1,10 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSecretInformation = hasSecretInformation;
|
|
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
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,12 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasTimeLimit = hasTimeLimit;
|
|
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
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,14 +1,11 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasUndo = hasUndo;
|
|
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
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"}
|