@gamepark/rules-api 5.15.1 → 5.19.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/Dummy.js +1 -17
- package/dist/Dummy.js.map +1 -1
- package/dist/Rules.d.ts +7 -2
- package/dist/Rules.js +34 -0
- package/dist/Rules.js.map +1 -1
- package/dist/index.d.ts +0 -2
- package/dist/index.js +3 -5
- package/dist/index.js.map +1 -1
- package/package.json +2 -2
- package/dist/ActionWithViews.d.ts +0 -11
- package/dist/ActionWithViews.js +0 -33
- package/dist/ActionWithViews.js.map +0 -1
- package/dist/GameOptions.d.ts +0 -3
- package/dist/GameOptions.js +0 -3
- package/dist/GameOptions.js.map +0 -1
- package/dist/PlayerAction.d.ts +0 -10
- package/dist/PlayerAction.js +0 -28
- package/dist/PlayerAction.js.map +0 -1
- package/dist/SecretAction.d.ts +0 -6
- package/dist/SecretAction.js +0 -8
- package/dist/SecretAction.js.map +0 -1
- package/dist/SecretMove.d.ts +0 -5
- package/dist/SecretMove.js +0 -9
- package/dist/SecretMove.js.map +0 -1
- package/dist/UndoCreator.d.ts +0 -4
- package/dist/UndoCreator.js +0 -3
- package/dist/UndoCreator.js.map +0 -1
- package/dist/_Game.d.ts +0 -17
- package/dist/_Game.js +0 -23
- package/dist/_Game.js.map +0 -1
- package/dist/_Rules.d.ts +0 -11
- package/dist/_Rules.js +0 -3
- package/dist/_Rules.js.map +0 -1
- package/dist/options/BooleanOption.d.ts +0 -6
- package/dist/options/BooleanOption.js +0 -3
- package/dist/options/BooleanOption.js.map +0 -1
- package/dist/options/BooleanOptionDescription.d.ts +0 -5
- package/dist/options/BooleanOptionDescription.js +0 -3
- package/dist/options/BooleanOptionDescription.js.map +0 -1
- package/dist/options/BooleanOptionSpec.d.ts +0 -4
- package/dist/options/BooleanOptionSpec.js +0 -3
- package/dist/options/BooleanOptionSpec.js.map +0 -1
- package/dist/options/EnumOptionSpec.d.ts +0 -6
- package/dist/options/EnumOptionSpec.js +0 -3
- package/dist/options/EnumOptionSpec.js.map +0 -1
- package/dist/options/GameOptions.d.ts +0 -6
- package/dist/options/GameOptions.js +0 -3
- package/dist/options/GameOptions.js.map +0 -1
- package/dist/options/GameOptionsOf.d.ts +0 -5
- package/dist/options/GameOptionsOf.js +0 -3
- package/dist/options/GameOptionsOf.js.map +0 -1
- package/dist/options/GameOptionsSpecs.d.ts +0 -5
- package/dist/options/GameOptionsSpecs.js +0 -3
- package/dist/options/GameOptionsSpecs.js.map +0 -1
- package/dist/options/IntegerOptionDescription.d.ts +0 -7
- package/dist/options/IntegerOptionDescription.js +0 -3
- package/dist/options/IntegerOptionDescription.js.map +0 -1
- package/dist/options/ListOptionDescription.d.ts +0 -8
- package/dist/options/ListOptionDescription.js +0 -3
- package/dist/options/ListOptionDescription.js.map +0 -1
- package/dist/options/OptionDescription.d.ts +0 -4
- package/dist/options/OptionDescription.js +0 -3
- package/dist/options/OptionDescription.js.map +0 -1
- package/dist/options/OptionDescriptionOf.d.ts +0 -4
- package/dist/options/OptionDescriptionOf.js +0 -3
- package/dist/options/OptionDescriptionOf.js.map +0 -1
- package/dist/options/OptionSpec.d.ts +0 -4
- package/dist/options/OptionSpec.js +0 -3
- package/dist/options/OptionSpec.js.map +0 -1
- package/dist/options/OptionType.d.ts +0 -6
- package/dist/options/OptionType.js +0 -10
- package/dist/options/OptionType.js.map +0 -1
- package/dist/options/OptionsDescription.d.ts +0 -23
- package/dist/options/OptionsDescription.js +0 -53
- package/dist/options/OptionsDescription.js.map +0 -1
- package/dist/options/PlayerIdsSpec.d.ts +0 -7
- package/dist/options/PlayerIdsSpec.js +0 -3
- package/dist/options/PlayerIdsSpec.js.map +0 -1
- package/dist/options/getPlayerName.d.ts +0 -4
- package/dist/options/getPlayerName.js +0 -16
- package/dist/options/getPlayerName.js.map +0 -1
package/dist/Dummy.js
CHANGED
|
@@ -12,15 +12,7 @@ var Dummy = /** @class */ (function () {
|
|
|
12
12
|
};
|
|
13
13
|
Dummy.prototype.getLegalMoves = function (state, playerId) {
|
|
14
14
|
var rules = new this.Rules(state);
|
|
15
|
-
if (
|
|
16
|
-
if (rules.getActivePlayer() === playerId) {
|
|
17
|
-
return rules.getLegalMoves();
|
|
18
|
-
}
|
|
19
|
-
else {
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
else if (hasLegalMoves(rules)) {
|
|
15
|
+
if (rules.getLegalMoves) {
|
|
24
16
|
return rules.getLegalMoves(playerId);
|
|
25
17
|
}
|
|
26
18
|
else {
|
|
@@ -31,12 +23,4 @@ var Dummy = /** @class */ (function () {
|
|
|
31
23
|
return Dummy;
|
|
32
24
|
}());
|
|
33
25
|
exports.default = Dummy;
|
|
34
|
-
function isSequentialGame(rules) {
|
|
35
|
-
var game = rules;
|
|
36
|
-
return typeof game.getActivePlayer === 'function' && typeof game.getLegalMoves === 'function';
|
|
37
|
-
}
|
|
38
|
-
function hasLegalMoves(rules) {
|
|
39
|
-
var game = rules;
|
|
40
|
-
return typeof game.getLegalMoves === 'function';
|
|
41
|
-
}
|
|
42
26
|
//# sourceMappingURL=Dummy.js.map
|
package/dist/Dummy.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Dummy.js","sourceRoot":"","sources":["../src/Dummy.ts"],"names":[],"mappings":";;
|
|
1
|
+
{"version":3,"file":"Dummy.js","sourceRoot":"","sources":["../src/Dummy.ts"],"names":[],"mappings":";;AAEA;IAIE,eAAY,KAA0C;QACpD,IAAI,CAAC,KAAK,GAAG,KAAK,CAAA;IACpB,CAAC;IAED,6BAAa,GAAb,UAAc,KAAY,EAAE,QAAkB;QAC5C,IAAI,KAAK,GAAG,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAA;QAC/C,IAAI,CAAC,KAAK,CAAC,MAAM;YAAE,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,CAAA;QAC7C,OAAO,OAAO,CAAC,OAAO,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAA;IAC3E,CAAC;IAED,6BAAa,GAAb,UAAc,KAAY,EAAE,QAAkB;QAC5C,IAAM,KAAK,GAAG,IAAI,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAA;QACnC,IAAI,KAAK,CAAC,aAAa,EAAE;YACvB,OAAO,KAAK,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAA;SACrC;aAAM;YACL,OAAO,CAAC,KAAK,CAAC,+DAA+D,CAAC,CAAA;YAC9E,OAAO,EAAE,CAAA;SACV;IACH,CAAC;IACH,YAAC;AAAD,CAAC,AAvBD,IAuBC"}
|
package/dist/Rules.d.ts
CHANGED
|
@@ -1,6 +1,11 @@
|
|
|
1
1
|
import Game from './Game';
|
|
2
|
-
export default
|
|
2
|
+
export default abstract class Rules<State = any, Move = any, PlayerId = any> implements Game<State, Move> {
|
|
3
|
+
state: State;
|
|
4
|
+
protected constructor(game: State);
|
|
3
5
|
isTurnToPlay(playerId: PlayerId): boolean;
|
|
6
|
+
getActivePlayer?(): PlayerId | undefined;
|
|
4
7
|
isLegalMove(playerId: PlayerId, move: Move): boolean;
|
|
5
|
-
|
|
8
|
+
getLegalMoves?(playerId: PlayerId): Move[];
|
|
9
|
+
abstract play(move: Move): void;
|
|
10
|
+
isOver(playerIds: PlayerId[]): boolean;
|
|
6
11
|
}
|
package/dist/Rules.js
CHANGED
|
@@ -1,3 +1,37 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
var fast_deep_equal_1 = __importDefault(require("fast-deep-equal"));
|
|
7
|
+
var Eliminations_1 = require("./Eliminations");
|
|
8
|
+
var Rules = /** @class */ (function () {
|
|
9
|
+
function Rules(game) {
|
|
10
|
+
this.state = game;
|
|
11
|
+
}
|
|
12
|
+
Rules.prototype.isTurnToPlay = function (playerId) {
|
|
13
|
+
if (!this.getActivePlayer) {
|
|
14
|
+
throw new Error('You must either implement "isTurnToPlay" or "getActivePlayer" if only one player is active at a time');
|
|
15
|
+
}
|
|
16
|
+
return playerId === this.getActivePlayer();
|
|
17
|
+
};
|
|
18
|
+
Rules.prototype.isLegalMove = function (playerId, move) {
|
|
19
|
+
if (!this.getLegalMoves) {
|
|
20
|
+
throw new Error('You must either implement "isLegalMove" or "getLegalMoves');
|
|
21
|
+
}
|
|
22
|
+
if (this.getLegalMoves(playerId).some(function (legalMove) { return (0, fast_deep_equal_1.default)(move, legalMove); })) {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
if ((0, Eliminations_1.hasEliminations)(this) && this.giveUpMove) {
|
|
26
|
+
return (0, fast_deep_equal_1.default)(move, this.giveUpMove(playerId));
|
|
27
|
+
}
|
|
28
|
+
return false;
|
|
29
|
+
};
|
|
30
|
+
Rules.prototype.isOver = function (playerIds) {
|
|
31
|
+
var _this = this;
|
|
32
|
+
return !playerIds.some(function (playerId) { return _this.isTurnToPlay(playerId); });
|
|
33
|
+
};
|
|
34
|
+
return Rules;
|
|
35
|
+
}());
|
|
36
|
+
exports.default = Rules;
|
|
3
37
|
//# 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":";;;;;AACA,oEAAmC;AACnC,+CAA8C;AAE9C;IAGE,eAAsB,IAAW;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAED,4BAAY,GAAZ,UAAa,QAAkB;QAC7B,IAAI,CAAC,IAAI,CAAC,eAAe,EAAE;YACzB,MAAM,IAAI,KAAK,CAAC,sGAAsG,CAAC,CAAA;SACxH;QACD,OAAO,QAAQ,KAAK,IAAI,CAAC,eAAe,EAAE,CAAA;IAC5C,CAAC;IAID,2BAAW,GAAX,UAAY,QAAkB,EAAE,IAAU;QACxC,IAAI,CAAC,IAAI,CAAC,aAAa,EAAE;YACvB,MAAM,IAAI,KAAK,CAAC,2DAA2D,CAAC,CAAA;SAC7E;QACD,IAAI,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC,UAAA,SAAS,IAAI,OAAA,IAAA,yBAAK,EAAC,IAAI,EAAE,SAAS,CAAC,EAAtB,CAAsB,CAAC,EAAE;YAC1E,OAAO,IAAI,CAAA;SACZ;QACD,IAAI,IAAA,8BAAe,EAAC,IAAI,CAAC,IAAI,IAAI,CAAC,UAAU,EAAE;YAC5C,OAAO,IAAA,yBAAK,EAAC,IAAI,EAAE,IAAI,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC,CAAA;SAC9C;QACD,OAAO,KAAK,CAAA;IACd,CAAC;IAMD,sBAAM,GAAN,UAAO,SAAqB;QAA5B,iBAEC;QADC,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,UAAA,QAAQ,IAAI,OAAA,KAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAA3B,CAA2B,CAAC,CAAA;IACjE,CAAC;IACH,YAAC;AAAD,CAAC,AApCD,IAoCC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
export { default as Game } from './Game';
|
|
2
2
|
export * from './Game';
|
|
3
3
|
export { default as Rules } from './Rules';
|
|
4
|
-
export { default as SequentialGame } from './SequentialGame';
|
|
5
|
-
export { default as SimultaneousGame } from './SimultaneousGame';
|
|
6
4
|
export { default as GameCreator } from './GameCreator';
|
|
7
5
|
export { default as RulesCreator } from './RulesCreator';
|
|
8
6
|
export { default as Action } from './Action';
|
package/dist/index.js
CHANGED
|
@@ -17,12 +17,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
17
17
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
18
|
};
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.Dummy = exports.
|
|
20
|
+
exports.Dummy = exports.Rules = void 0;
|
|
21
21
|
__exportStar(require("./Game"), exports);
|
|
22
|
-
var
|
|
23
|
-
Object.defineProperty(exports, "
|
|
24
|
-
var SimultaneousGame_1 = require("./SimultaneousGame");
|
|
25
|
-
Object.defineProperty(exports, "SimultaneousGame", { enumerable: true, get: function () { return __importDefault(SimultaneousGame_1).default; } });
|
|
22
|
+
var Rules_1 = require("./Rules");
|
|
23
|
+
Object.defineProperty(exports, "Rules", { enumerable: true, get: function () { return __importDefault(Rules_1).default; } });
|
|
26
24
|
__exportStar(require("./Action"), exports);
|
|
27
25
|
__exportStar(require("./IncompleteInformation"), exports);
|
|
28
26
|
__exportStar(require("./Undo"), exports);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,yCAAsB;
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;AACA,yCAAsB;AACtB,iCAAwC;AAAhC,+GAAA,OAAO,OAAS;AAKxB,2CAAwB;AAGxB,0DAAuC;AAGvC,yCAAsB;AAGtB,gDAA6B;AAG7B,iDAA8B;AAG9B,iDAA8B;AAG9B,8CAA2B;AAG3B,iCAAwC;AAAhC,+GAAA,OAAO,OAAS;AAExB,4CAAyB;AACzB,0CAAuB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/rules-api",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.19.0",
|
|
4
4
|
"description": "API to implement the rules of a board game",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -27,5 +27,5 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"i18next": ">=21.3.0"
|
|
29
29
|
},
|
|
30
|
-
"gitHead": "
|
|
30
|
+
"gitHead": "1c0efa27e6557111a721fd1ad0c95ac1394a3543"
|
|
31
31
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import { IncompleteInformation } from './index';
|
|
2
|
-
import PlayerAction from './PlayerAction';
|
|
3
|
-
declare type ActionWithViews<Move, MoveView, PlayerId> = {
|
|
4
|
-
action: PlayerAction<Move, PlayerId>;
|
|
5
|
-
views: {
|
|
6
|
-
recipient?: PlayerId;
|
|
7
|
-
action: PlayerAction<MoveView, PlayerId>;
|
|
8
|
-
}[];
|
|
9
|
-
};
|
|
10
|
-
export default ActionWithViews;
|
|
11
|
-
export declare function playActionWithViews<State, View, Move, MoveView, PlayerId>(game: IncompleteInformation<State, View, Move, MoveView, PlayerId>, move: Move, playerId: PlayerId, recipients: PlayerId[]): ActionWithViews<Move, MoveView, PlayerId>;
|
package/dist/ActionWithViews.js
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.playActionWithViews = void 0;
|
|
4
|
-
var index_1 = require("./index");
|
|
5
|
-
function playActionWithViews(game, move, playerId, recipients) {
|
|
6
|
-
var actionWithView = {
|
|
7
|
-
action: { playerId: playerId, move: move, consequences: [] },
|
|
8
|
-
views: []
|
|
9
|
-
};
|
|
10
|
-
game.play(JSON.parse(JSON.stringify(move)));
|
|
11
|
-
// Prepare action view for each player
|
|
12
|
-
for (var _i = 0, recipients_1 = recipients; _i < recipients_1.length; _i++) {
|
|
13
|
-
var recipient = recipients_1[_i];
|
|
14
|
-
actionWithView.views.push({ recipient: recipient, action: { playerId: playerId, move: index_1.getMoveView(game, move, recipient), consequences: [] } });
|
|
15
|
-
}
|
|
16
|
-
// Prepare action view for spectators
|
|
17
|
-
actionWithView.views.push({ action: { playerId: playerId, move: index_1.getMoveView(game, move), consequences: [] } });
|
|
18
|
-
index_1.loopWithFuse(function () {
|
|
19
|
-
var consequence = game.getAutomaticMove ? game.getAutomaticMove() : undefined;
|
|
20
|
-
if (consequence) {
|
|
21
|
-
game.play(JSON.parse(JSON.stringify(consequence)));
|
|
22
|
-
actionWithView.action.consequences.push(consequence);
|
|
23
|
-
for (var _i = 0, _a = actionWithView.views; _i < _a.length; _i++) {
|
|
24
|
-
var view = _a[_i];
|
|
25
|
-
view.action.consequences.push(index_1.getMoveView(game, consequence, view.recipient));
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return consequence !== undefined;
|
|
29
|
-
}, { errorFn: function () { return new Error("Infinite loop detected while applying automatic moves after " + move + " in " + game.state); } });
|
|
30
|
-
return actionWithView;
|
|
31
|
-
}
|
|
32
|
-
exports.playActionWithViews = playActionWithViews;
|
|
33
|
-
//# sourceMappingURL=ActionWithViews.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ActionWithViews.js","sourceRoot":"","sources":["../src/ActionWithViews.ts"],"names":[],"mappings":";;;AAAA,iCAAwE;AAaxE,SAAgB,mBAAmB,CACjC,IAAkE,EAAE,IAAU,EAAE,QAAkB,EAAE,UAAsB;IAE1H,IAAM,cAAc,GAA8C;QAChE,MAAM,EAAE,EAAC,QAAQ,UAAA,EAAE,IAAI,MAAA,EAAE,YAAY,EAAE,EAAE,EAAC;QAC1C,KAAK,EAAE,EAAE;KACV,CAAA;IACD,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAE3C,sCAAsC;IACtC,KAAwB,UAAU,EAAV,yBAAU,EAAV,wBAAU,EAAV,IAAU,EAAE;QAA/B,IAAM,SAAS,mBAAA;QAClB,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,SAAS,WAAA,EAAE,MAAM,EAAE,EAAC,QAAQ,UAAA,EAAE,IAAI,EAAE,mBAAW,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,CAAC,EAAE,YAAY,EAAE,EAAE,EAAC,EAAC,CAAC,CAAA;KACvH;IACD,qCAAqC;IACrC,cAAc,CAAC,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,EAAC,QAAQ,UAAA,EAAE,IAAI,EAAE,mBAAW,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,YAAY,EAAE,EAAE,EAAC,EAAC,CAAC,CAAA;IAEhG,oBAAY,CAAC;QACX,IAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC/E,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;YAClD,cAAc,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;YACpD,KAAmB,UAAoB,EAApB,KAAA,cAAc,CAAC,KAAK,EAApB,cAAoB,EAApB,IAAoB,EAAE;gBAApC,IAAM,IAAI,SAAA;gBACb,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,mBAAW,CAAC,IAAI,EAAE,WAAW,EAAE,IAAI,CAAC,SAAS,CAAC,CAAC,CAAA;aAC9E;SACF;QACD,OAAO,WAAW,KAAK,SAAS,CAAA;IAClC,CAAC,EAAE,EAAC,OAAO,EAAE,cAAM,OAAA,IAAI,KAAK,CAAC,iEAA+D,IAAI,YAAO,IAAI,CAAC,KAAO,CAAC,EAAjG,CAAiG,EAAC,CAAC,CAAA;IACtH,OAAO,cAAc,CAAA;AACvB,CAAC;AA5BD,kDA4BC"}
|
package/dist/GameOptions.d.ts
DELETED
package/dist/GameOptions.js
DELETED
package/dist/GameOptions.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GameOptions.js","sourceRoot":"","sources":["../src/GameOptions.ts"],"names":[],"mappings":""}
|
package/dist/PlayerAction.d.ts
DELETED
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import Action from './Action';
|
|
2
|
-
import Game from './Game';
|
|
3
|
-
declare type PlayerAction<Move = any, PlayerId = any> = Action<Move> & {
|
|
4
|
-
playerId: PlayerId;
|
|
5
|
-
};
|
|
6
|
-
export default PlayerAction;
|
|
7
|
-
export declare function playAction<State, Move>(game: Game<State, Move>, move: Move): Action<Move>;
|
|
8
|
-
export declare function playAction<State, Move, PlayerId>(game: Game<State, Move>, move: Move, playerId: PlayerId): PlayerAction<Move, PlayerId>;
|
|
9
|
-
export declare function replayAction<State, Move>(game: Game<State, Move>, action: Action<Move>): void;
|
|
10
|
-
export declare function replayActions<State, Move>(game: Game<State, Move>, actions: Action<Move>[]): void;
|
package/dist/PlayerAction.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.replayActions = exports.replayAction = exports.playAction = void 0;
|
|
4
|
-
var Game_1 = require("./Game");
|
|
5
|
-
function playAction(game, move, playerId) {
|
|
6
|
-
var action = { playerId: playerId, move: move, consequences: [] };
|
|
7
|
-
game.play(JSON.parse(JSON.stringify(move)));
|
|
8
|
-
Game_1.loopWithFuse(function () {
|
|
9
|
-
var consequence = game.getAutomaticMove ? game.getAutomaticMove() : undefined;
|
|
10
|
-
if (consequence) {
|
|
11
|
-
game.play(JSON.parse(JSON.stringify(consequence)));
|
|
12
|
-
action.consequences.push(consequence);
|
|
13
|
-
}
|
|
14
|
-
return consequence !== undefined;
|
|
15
|
-
}, { errorFn: function () { return new Error("Infinite loop detected while applying automatic moves after " + move + " in " + game.state); } });
|
|
16
|
-
return action;
|
|
17
|
-
}
|
|
18
|
-
exports.playAction = playAction;
|
|
19
|
-
function replayAction(game, action) {
|
|
20
|
-
game.play(JSON.parse(JSON.stringify(action.move)));
|
|
21
|
-
action.consequences.forEach(function (move) { return game.play(JSON.parse(JSON.stringify(move))); });
|
|
22
|
-
}
|
|
23
|
-
exports.replayAction = replayAction;
|
|
24
|
-
function replayActions(game, actions) {
|
|
25
|
-
actions.forEach(function (action) { return replayAction(game, action); });
|
|
26
|
-
}
|
|
27
|
-
exports.replayActions = replayActions;
|
|
28
|
-
//# sourceMappingURL=PlayerAction.js.map
|
package/dist/PlayerAction.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerAction.js","sourceRoot":"","sources":["../src/PlayerAction.ts"],"names":[],"mappings":";;;AACA,+BAAyC;AAUzC,SAAgB,UAAU,CAAwB,IAAuB,EAAE,IAAU,EAAE,QAAmB;IACxG,IAAM,MAAM,GAAgD,EAAC,QAAQ,UAAA,EAAE,IAAI,MAAA,EAAE,YAAY,EAAE,EAAE,EAAC,CAAA;IAC9F,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAC3C,mBAAY,CAAC;QACX,IAAM,WAAW,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC,IAAI,CAAC,gBAAgB,EAAE,CAAC,CAAC,CAAC,SAAS,CAAA;QAC/E,IAAI,WAAW,EAAE;YACf,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,CAAC,CAAC,CAAA;YAClD,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,WAAW,CAAC,CAAA;SACtC;QACD,OAAO,WAAW,KAAK,SAAS,CAAA;IAClC,CAAC,EAAE,EAAC,OAAO,EAAE,cAAM,OAAA,IAAI,KAAK,CAAC,iEAA+D,IAAI,YAAO,IAAI,CAAC,KAAO,CAAC,EAAjG,CAAiG,EAAC,CAAC,CAAA;IACtH,OAAO,MAAM,CAAA;AACf,CAAC;AAZD,gCAYC;AAED,SAAgB,YAAY,CAAc,IAAuB,EAAE,MAAoB;IACrF,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IAClD,MAAM,CAAC,YAAY,CAAC,OAAO,CAAC,UAAA,IAAI,IAAI,OAAA,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC,EAA3C,CAA2C,CAAC,CAAA;AAClF,CAAC;AAHD,oCAGC;AAED,SAAgB,aAAa,CAAc,IAAuB,EAAE,OAAuB;IACzF,OAAO,CAAC,OAAO,CAAC,UAAA,MAAM,IAAI,OAAA,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,EAA1B,CAA0B,CAAC,CAAA;AACvD,CAAC;AAFD,sCAEC"}
|
package/dist/SecretAction.d.ts
DELETED
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import Action, { ActionView } from './Action';
|
|
2
|
-
declare type SecretAction<Move = any, MoveView = Move, PlayerId = any> = Action<Move, PlayerId> & {
|
|
3
|
-
secrets: ActionView<MoveView, PlayerId>[];
|
|
4
|
-
};
|
|
5
|
-
export default SecretAction;
|
|
6
|
-
export declare function isSecretAction(action: Action): action is SecretAction;
|
package/dist/SecretAction.js
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isSecretAction = void 0;
|
|
4
|
-
function isSecretAction(action) {
|
|
5
|
-
return Array.isArray(action.secrets);
|
|
6
|
-
}
|
|
7
|
-
exports.isSecretAction = isSecretAction;
|
|
8
|
-
//# sourceMappingURL=SecretAction.js.map
|
package/dist/SecretAction.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SecretAction.js","sourceRoot":"","sources":["../src/SecretAction.ts"],"names":[],"mappings":";;;AAQA,SAAgB,cAAc,CAAC,MAAc;IAC3C,OAAO,KAAK,CAAC,OAAO,CAAE,MAAuB,CAAC,OAAO,CAAC,CAAA;AACxD,CAAC;AAFD,wCAEC"}
|
package/dist/SecretMove.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import Rules from './Rules';
|
|
2
|
-
export default interface SecretMove<State, Move = string, PlayerId = number> extends Rules<State, Move, PlayerId> {
|
|
3
|
-
keepMoveSecret(move: Move): boolean;
|
|
4
|
-
}
|
|
5
|
-
export declare function hasSecretMove<State, Move, PlayerId>(rules: Rules<State, Move, PlayerId>): rules is SecretMove<State, Move, PlayerId>;
|
package/dist/SecretMove.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.hasSecretMove = void 0;
|
|
4
|
-
function hasSecretMove(rules) {
|
|
5
|
-
var game = rules;
|
|
6
|
-
return typeof game.keepMoveSecret === 'function';
|
|
7
|
-
}
|
|
8
|
-
exports.hasSecretMove = hasSecretMove;
|
|
9
|
-
//# sourceMappingURL=SecretMove.js.map
|
package/dist/SecretMove.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SecretMove.js","sourceRoot":"","sources":["../src/SecretMove.ts"],"names":[],"mappings":";;;AAMA,SAAgB,aAAa,CAAwB,KAAmC;IACtF,IAAM,IAAI,GAAG,KAA0C,CAAA;IACvD,OAAO,OAAO,IAAI,CAAC,cAAc,KAAK,UAAU,CAAA;AAClD,CAAC;AAHD,sCAGC"}
|
package/dist/UndoCreator.d.ts
DELETED
package/dist/UndoCreator.js
DELETED
package/dist/UndoCreator.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"UndoCreator.js","sourceRoot":"","sources":["../src/UndoCreator.ts"],"names":[],"mappings":""}
|
package/dist/_Game.d.ts
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import Action from './Action';
|
|
2
|
-
import _Rules from './_Rules';
|
|
3
|
-
export default abstract class _Game<State = any, Move = any, PlayerId = any> implements _Rules<Move, PlayerId> {
|
|
4
|
-
state: State;
|
|
5
|
-
protected constructor(game: State);
|
|
6
|
-
abstract getPlayerIds(): PlayerId[];
|
|
7
|
-
abstract isActive(playerId: PlayerId): boolean;
|
|
8
|
-
abstract getActivePlayers(): PlayerId[];
|
|
9
|
-
abstract isLegalMove(playerId: PlayerId, move: Move): boolean;
|
|
10
|
-
abstract getLegalMoves?(playerId: PlayerId): Move[];
|
|
11
|
-
abstract play(move: Move, playerId?: PlayerId): void;
|
|
12
|
-
getAutomaticMove(): Move | void;
|
|
13
|
-
canUndo(_action: Action<Move, PlayerId>, _consecutiveActions: Action<Move, PlayerId>[]): boolean;
|
|
14
|
-
static getPlayerName(playerId: any, t: (name: string, values?: {
|
|
15
|
-
[key: string]: any;
|
|
16
|
-
}) => string): string;
|
|
17
|
-
}
|
package/dist/_Game.js
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var _Game = /** @class */ (function () {
|
|
4
|
-
function _Game(game) {
|
|
5
|
-
this.state = game;
|
|
6
|
-
}
|
|
7
|
-
_Game.prototype.getAutomaticMove = function () {
|
|
8
|
-
};
|
|
9
|
-
_Game.prototype.canUndo = function (_action, _consecutiveActions) {
|
|
10
|
-
return false;
|
|
11
|
-
};
|
|
12
|
-
_Game.getPlayerName = function (playerId, t) {
|
|
13
|
-
if (typeof playerId === 'number') {
|
|
14
|
-
return t('Player {number}', { number: playerId });
|
|
15
|
-
}
|
|
16
|
-
else {
|
|
17
|
-
return t(playerId);
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
return _Game;
|
|
21
|
-
}());
|
|
22
|
-
exports.default = _Game;
|
|
23
|
-
//# sourceMappingURL=_Game.js.map
|
package/dist/_Game.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_Game.js","sourceRoot":"","sources":["../src/_Game.ts"],"names":[],"mappings":";;AAGA;IAGE,eAAsB,IAAW;QAC/B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAA;IACnB,CAAC;IAcD,gCAAgB,GAAhB;IACA,CAAC;IAED,uBAAO,GAAP,UAAQ,OAA+B,EAAE,mBAA6C;QACpF,OAAO,KAAK,CAAA;IACd,CAAC;IAEM,mBAAa,GAApB,UAAqB,QAAa,EAAE,CAA4D;QAC9F,IAAI,OAAO,QAAQ,KAAK,QAAQ,EAAE;YAChC,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,QAAQ,EAAC,CAAC,CAAA;SAChD;aAAM;YACL,OAAO,CAAC,CAAC,QAAQ,CAAC,CAAA;SACnB;IACH,CAAC;IACH,YAAC;AAAD,CAAC,AAjCD,IAiCC"}
|
package/dist/_Rules.d.ts
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import Action from './Action';
|
|
2
|
-
export default interface _Rules<Move = any, PlayerId = any> {
|
|
3
|
-
getPlayerIds(): PlayerId[];
|
|
4
|
-
getActivePlayers(): PlayerId[];
|
|
5
|
-
isActive(playerId: PlayerId): boolean;
|
|
6
|
-
isLegalMove(playerId: PlayerId, move: Move): boolean;
|
|
7
|
-
getLegalMoves?(playerId: PlayerId): Move[];
|
|
8
|
-
play(move: Move, playerId?: PlayerId): void;
|
|
9
|
-
getAutomaticMove(): Move | void;
|
|
10
|
-
canUndo(_action: Action<Move, PlayerId>, _consecutiveActions: Action<Move, PlayerId>[]): boolean;
|
|
11
|
-
}
|
package/dist/_Rules.js
DELETED
package/dist/_Rules.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"_Rules.js","sourceRoot":"","sources":["../src/_Rules.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanOption.js","sourceRoot":"","sources":["../../src/options/BooleanOption.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanOptionDescription.js","sourceRoot":"","sources":["../../src/options/BooleanOptionDescription.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"BooleanOptionSpec.js","sourceRoot":"","sources":["../../src/options/BooleanOptionSpec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"EnumOptionSpec.js","sourceRoot":"","sources":["../../src/options/EnumOptionSpec.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GameOptions.js","sourceRoot":"","sources":["../../src/options/GameOptions.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GameOptionsOf.js","sourceRoot":"","sources":["../../src/options/GameOptionsOf.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"GameOptionsSpecs.js","sourceRoot":"","sources":["../../src/options/GameOptionsSpecs.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"IntegerOptionDescription.js","sourceRoot":"","sources":["../../src/options/IntegerOptionDescription.ts"],"names":[],"mappings":""}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { TFunction } from 'i18next';
|
|
2
|
-
import OptionDescription from './OptionDescription';
|
|
3
|
-
import OptionType from './OptionType';
|
|
4
|
-
export default interface ListOptionDescription<T = any> extends OptionDescription {
|
|
5
|
-
type: typeof OptionType.LIST;
|
|
6
|
-
values: T[];
|
|
7
|
-
getValueLabel: (value: T, t: TFunction) => string;
|
|
8
|
-
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ListOptionDescription.js","sourceRoot":"","sources":["../../src/options/ListOptionDescription.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionDescription.js","sourceRoot":"","sources":["../../src/options/OptionDescription.ts"],"names":[],"mappings":""}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import BooleanOptionDescription from './BooleanOptionDescription';
|
|
2
|
-
import ListOptionDescription from './ListOptionDescription';
|
|
3
|
-
declare type OptionDescriptionOf<T> = [T] extends [boolean] ? BooleanOptionDescription : ListOptionDescription<T>;
|
|
4
|
-
export default OptionDescriptionOf;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionDescriptionOf.js","sourceRoot":"","sources":["../../src/options/OptionDescriptionOf.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionSpec.js","sourceRoot":"","sources":["../../src/options/OptionSpec.ts"],"names":[],"mappings":""}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var OptionType;
|
|
4
|
-
(function (OptionType) {
|
|
5
|
-
OptionType[OptionType["BOOLEAN"] = 0] = "BOOLEAN";
|
|
6
|
-
OptionType[OptionType["LIST"] = 1] = "LIST";
|
|
7
|
-
OptionType[OptionType["INTEGER"] = 2] = "INTEGER";
|
|
8
|
-
})(OptionType || (OptionType = {}));
|
|
9
|
-
exports.default = OptionType;
|
|
10
|
-
//# sourceMappingURL=OptionType.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionType.js","sourceRoot":"","sources":["../../src/options/OptionType.ts"],"names":[],"mappings":";;AAAA,IAAK,UAEJ;AAFD,WAAK,UAAU;IACb,iDAAO,CAAA;IAAE,2CAAI,CAAA;IAAE,iDAAO,CAAA;AACxB,CAAC,EAFI,UAAU,KAAV,UAAU,QAEd;AAED,kBAAe,UAAU,CAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import ListOptionDescription from './ListOptionDescription';
|
|
2
|
-
import OptionDescriptionOf from './OptionDescriptionOf';
|
|
3
|
-
declare type OptionsDescription<GameOptions = {
|
|
4
|
-
[key in Exclude<string, 'player'>]: any;
|
|
5
|
-
}, PlayerOptions = {
|
|
6
|
-
[key in Exclude<string, 'id'>]: any;
|
|
7
|
-
} & {
|
|
8
|
-
id?: ListOptionDescription;
|
|
9
|
-
}> = {
|
|
10
|
-
[key in keyof GameOptions]: OptionDescriptionOf<GameOptions[key]>;
|
|
11
|
-
} & {
|
|
12
|
-
players: {
|
|
13
|
-
[key in keyof PlayerOptions]: OptionDescriptionOf<PlayerOptions[key]>;
|
|
14
|
-
} & {
|
|
15
|
-
id?: ListOptionDescription;
|
|
16
|
-
};
|
|
17
|
-
};
|
|
18
|
-
export default OptionsDescription;
|
|
19
|
-
export declare function providePlayerIds<GameOptions, PlayerOptions extends {
|
|
20
|
-
id?: any;
|
|
21
|
-
}>(options?: OptionsDescription<GameOptions, PlayerOptions>, players?: PlayerOptions[] | number): (PlayerOptions & {
|
|
22
|
-
id: any;
|
|
23
|
-
})[];
|
|
@@ -1,53 +0,0 @@
|
|
|
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.providePlayerIds = void 0;
|
|
7
|
-
var lodash_shuffle_1 = __importDefault(require("lodash.shuffle"));
|
|
8
|
-
var index_1 = require("../index");
|
|
9
|
-
function providePlayerIds(options, players) {
|
|
10
|
-
var ids = lodash_shuffle_1.default(getIds(options, Array.isArray(players) ? players.length : players));
|
|
11
|
-
if (Array.isArray(players)) {
|
|
12
|
-
var _loop_1 = function (player) {
|
|
13
|
-
if (player.id !== undefined) {
|
|
14
|
-
var idIndex = ids.findIndex(function (id) { return player.id === id; });
|
|
15
|
-
if (idIndex === -1) {
|
|
16
|
-
console.error("Unexpected player id: " + player.id + ", should be one of: " + ids);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
ids.splice(idIndex, 1);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
};
|
|
23
|
-
for (var _i = 0, players_1 = players; _i < players_1.length; _i++) {
|
|
24
|
-
var player = players_1[_i];
|
|
25
|
-
_loop_1(player);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
if (!players)
|
|
29
|
-
players = ids.length;
|
|
30
|
-
if (typeof players === 'number')
|
|
31
|
-
players = Array.from({ length: players }, Object);
|
|
32
|
-
for (var _a = 0, players_2 = players; _a < players_2.length; _a++) {
|
|
33
|
-
var player = players_2[_a];
|
|
34
|
-
if (player.id === undefined) {
|
|
35
|
-
player.id = ids.shift();
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return players;
|
|
39
|
-
}
|
|
40
|
-
exports.providePlayerIds = providePlayerIds;
|
|
41
|
-
function getIds(options, players) {
|
|
42
|
-
var _a, _b;
|
|
43
|
-
if (((_b = (_a = options === null || options === void 0 ? void 0 : options.players) === null || _a === void 0 ? void 0 : _a.id) === null || _b === void 0 ? void 0 : _b.type) === index_1.OptionType.LIST) {
|
|
44
|
-
return options.players.id.values;
|
|
45
|
-
}
|
|
46
|
-
else if (players) {
|
|
47
|
-
return Array.from(Array(players).keys());
|
|
48
|
-
}
|
|
49
|
-
else {
|
|
50
|
-
return [0, 1];
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
//# sourceMappingURL=OptionsDescription.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"OptionsDescription.js","sourceRoot":"","sources":["../../src/options/OptionsDescription.ts"],"names":[],"mappings":";;;;;;AAAA,kEAAoC;AACpC,kCAAmC;AAcnC,SAAgB,gBAAgB,CAAkD,OAAwD,EAAE,OAAkC;IAC5K,IAAM,GAAG,GAAG,wBAAO,CAAC,MAAM,CAAC,OAAO,EAAE,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAA;IACvF,IAAI,KAAK,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE;gCACf,MAAM;YACf,IAAI,MAAM,CAAC,EAAE,KAAK,SAAS,EAAE;gBAC3B,IAAM,OAAO,GAAG,GAAG,CAAC,SAAS,CAAC,UAAA,EAAE,IAAI,OAAA,MAAM,CAAC,EAAE,KAAK,EAAE,EAAhB,CAAgB,CAAC,CAAA;gBACrD,IAAI,OAAO,KAAK,CAAC,CAAC,EAAE;oBAClB,OAAO,CAAC,KAAK,CAAC,2BAAyB,MAAM,CAAC,EAAE,4BAAuB,GAAK,CAAC,CAAA;iBAC9E;qBAAM;oBACL,GAAG,CAAC,MAAM,CAAC,OAAO,EAAE,CAAC,CAAC,CAAA;iBACvB;aACF;;QARH,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO;YAAvB,IAAM,MAAM,gBAAA;oBAAN,MAAM;SAShB;KACF;IACD,IAAI,CAAC,OAAO;QAAE,OAAO,GAAG,GAAG,CAAC,MAAM,CAAA;IAClC,IAAI,OAAO,OAAO,KAAK,QAAQ;QAAE,OAAO,GAAG,KAAK,CAAC,IAAI,CAAC,EAAC,MAAM,EAAE,OAAO,EAAC,EAAE,MAAM,CAAC,CAAA;IAChF,KAAqB,UAAO,EAAP,mBAAO,EAAP,qBAAO,EAAP,IAAO,EAAE;QAAzB,IAAM,MAAM,gBAAA;QACf,IAAI,MAAM,CAAC,EAAE,KAAK,SAAS,EAAE;YAC3B,MAAM,CAAC,EAAE,GAAG,GAAG,CAAC,KAAK,EAAE,CAAA;SACxB;KACF;IACD,OAAO,OAAwC,CAAA;AACjD,CAAC;AAtBD,4CAsBC;AAED,SAAS,MAAM,CAAkD,OAAwD,EAAE,OAAgB;;IACzI,IAAI,CAAA,MAAA,MAAA,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,0CAAE,EAAE,0CAAE,IAAI,MAAK,kBAAU,CAAC,IAAI,EAAE;QAClD,OAAO,OAAO,CAAC,OAAO,CAAC,EAAE,CAAC,MAAM,CAAA;KACjC;SAAM,IAAI,OAAO,EAAE;QAClB,OAAO,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,CAAC,CAAA;KACzC;SAAM;QACL,OAAO,CAAC,CAAC,EAAE,CAAC,CAAC,CAAA;KACd;AACH,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerIdsSpec.js","sourceRoot":"","sources":["../../src/options/PlayerIdsSpec.ts"],"names":[],"mappings":""}
|
|
@@ -1,16 +0,0 @@
|
|
|
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
|
-
var isWithPlayerIdOptions_1 = __importDefault(require("./isWithPlayerIdOptions"));
|
|
7
|
-
function getPlayerName(id, t, optionsSpec) {
|
|
8
|
-
if (optionsSpec && isWithPlayerIdOptions_1.default(optionsSpec)) {
|
|
9
|
-
return optionsSpec.players.id.valueLabel(id, t);
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return t('Player {number}', { number: id });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = getPlayerName;
|
|
16
|
-
//# sourceMappingURL=getPlayerName.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getPlayerName.js","sourceRoot":"","sources":["../../src/options/getPlayerName.ts"],"names":[],"mappings":";;;;;AACA,kFAA2D;AAI3D,SAAwB,aAAa,CAA0C,EAAM,EAAE,CAAY,EAAE,WAAkC;IACrI,IAAI,WAAW,IAAI,+BAAqB,CAAiB,WAAW,CAAC,EAAE;QACrE,OAAO,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,UAAU,CAAC,EAAE,EAAE,CAAC,CAAC,CAAA;KAChD;SAAM;QACL,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,CAAC,CAAA;KAC1C;AACH,CAAC;AAND,gCAMC"}
|