@gamepark/rules-api 5.23.0 → 5.24.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/Action.d.ts +25 -25
- package/dist/Action.js +45 -55
- package/dist/Action.js.map +1 -1
- package/dist/ApplyAutomaticMoves.d.ts +2 -2
- package/dist/ApplyAutomaticMoves.js +18 -24
- package/dist/ApplyAutomaticMoves.js.map +1 -1
- package/dist/Competitive.d.ts +6 -6
- package/dist/Competitive.js +3 -7
- package/dist/Competitive.js.map +1 -1
- package/dist/Dummy.d.ts +7 -7
- package/dist/Dummy.js +22 -25
- package/dist/Dummy.js.map +1 -1
- package/dist/Eliminations.d.ts +5 -5
- package/dist/Eliminations.js +4 -8
- package/dist/Eliminations.js.map +1 -1
- package/dist/IncompleteInformation.d.ts +14 -14
- package/dist/IncompleteInformation.js +30 -37
- package/dist/IncompleteInformation.js.map +1 -1
- package/dist/LoopWithFuse.d.ts +4 -4
- package/dist/LoopWithFuse.js +10 -14
- package/dist/LoopWithFuse.js.map +1 -1
- package/dist/RandomMove.d.ts +7 -7
- package/dist/RandomMove.js +7 -12
- package/dist/RandomMove.js.map +1 -1
- package/dist/Robot.d.ts +2 -2
- package/dist/Robot.js +1 -2
- package/dist/Rules.d.ts +14 -14
- package/dist/Rules.js +63 -74
- package/dist/Rules.js.map +1 -1
- package/dist/RulesCreator.d.ts +5 -5
- package/dist/RulesCreator.js +1 -2
- package/dist/TimeLimit.d.ts +18 -18
- package/dist/TimeLimit.js +8 -12
- package/dist/TimeLimit.js.map +1 -1
- package/dist/Undo.d.ts +6 -6
- package/dist/Undo.js +4 -8
- package/dist/Undo.js.map +1 -1
- package/dist/index.d.ts +22 -22
- package/dist/index.js +13 -37
- package/dist/index.js.map +1 -1
- package/dist/options/EnumOption.d.ts +7 -7
- package/dist/options/EnumOption.js +3 -7
- package/dist/options/EnumOption.js.map +1 -1
- package/dist/options/Option.d.ts +9 -9
- package/dist/options/Option.js +1 -2
- package/dist/options/OptionSpecOf.d.ts +4 -4
- package/dist/options/OptionSpecOf.js +1 -2
- package/dist/options/OptionsSpec.d.ts +10 -10
- package/dist/options/OptionsSpec.js +1 -2
- package/dist/options/OptionsValidationError.d.ts +4 -4
- package/dist/options/OptionsValidationError.js +7 -28
- package/dist/options/OptionsValidationError.js.map +1 -1
- package/dist/options/PlayerIdSpec.d.ts +8 -8
- package/dist/options/PlayerIdSpec.js +12 -17
- package/dist/options/PlayerIdSpec.js.map +1 -1
- package/dist/options/PlayersOptionsSpec.d.ts +8 -8
- package/dist/options/PlayersOptionsSpec.js +1 -2
- package/dist/options/WithIdOption.d.ts +4 -4
- package/dist/options/WithIdOption.js +1 -2
- package/dist/options/WithPlayerOptionsSpec.d.ts +5 -5
- package/dist/options/WithPlayerOptionsSpec.js +1 -2
- package/dist/options/WithPlayersOptions.d.ts +4 -4
- package/dist/options/WithPlayersOptions.js +1 -2
- package/dist/options/getFallbackPlayerName.d.ts +4 -4
- package/dist/options/getFallbackPlayerName.js +9 -15
- package/dist/options/getFallbackPlayerName.js.map +1 -1
- package/dist/options/index.d.ts +13 -13
- package/dist/options/index.js +5 -29
- package/dist/options/index.js.map +1 -1
- package/dist/options/isWithPlayerIdOptions.d.ts +4 -4
- package/dist/options/isWithPlayerIdOptions.js +7 -10
- package/dist/options/isWithPlayerIdOptions.js.map +1 -1
- package/dist/options/providePlayerIds.d.ts +6 -6
- package/dist/options/providePlayerIds.js +22 -37
- package/dist/options/providePlayerIds.js.map +1 -1
- package/dist/utils/EnumUtils.d.ts +1 -1
- package/dist/utils/EnumUtils.js +3 -7
- package/dist/utils/EnumUtils.js.map +1 -1
- package/dist/utils/index.d.ts +1 -1
- package/dist/utils/index.js +1 -17
- package/dist/utils/index.js.map +1 -1
- package/package.json +3 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PlayerIdSpec.js","sourceRoot":"","sources":["../../src/options/PlayerIdSpec.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"PlayerIdSpec.js","sourceRoot":"","sources":["../../src/options/PlayerIdSpec.ts"],"names":[],"mappings":"AASA,MAAM,UAAU,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,OAAO,IAAI,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;AACtD,CAAC;AAED,MAAM,UAAU,eAAe,CAAK,IAAsB,EAAE,OAAe;IACzE,IAAI,IAAI,CAAC,WAAW,EAAE,CAAC;QACrB,MAAM,cAAc,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,CAAA;QAChD,OAAO,IAAI,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;IAC/D,CAAC;SAAM,CAAC;QACN,OAAO,IAAI,CAAC,MAAM,CAAA;IACpB,CAAC;AACH,CAAC"}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import PlayerIdSpec from './PlayerIdSpec';
|
|
2
|
-
import WithIdOption from './WithIdOption';
|
|
3
|
-
|
|
4
|
-
id: PlayerIdSpec<Id>;
|
|
5
|
-
} : {}) & {
|
|
6
|
-
[key in keyof Omit<Options, 'id'>]: any;
|
|
7
|
-
};
|
|
8
|
-
export default PlayersOptionsSpec;
|
|
1
|
+
import PlayerIdSpec from './PlayerIdSpec';
|
|
2
|
+
import WithIdOption from './WithIdOption';
|
|
3
|
+
type PlayersOptionsSpec<Options> = (Options extends WithIdOption<infer Id> ? {
|
|
4
|
+
id: PlayerIdSpec<Id>;
|
|
5
|
+
} : {}) & {
|
|
6
|
+
[key in keyof Omit<Options, 'id'>]: any;
|
|
7
|
+
};
|
|
8
|
+
export default PlayersOptionsSpec;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
id: PlayerId;
|
|
3
|
-
};
|
|
4
|
-
export default WithIdOption;
|
|
1
|
+
type WithIdOption<PlayerId> = {
|
|
2
|
+
id: PlayerId;
|
|
3
|
+
};
|
|
4
|
+
export default WithIdOption;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import PlayersOptionsSpec from './PlayersOptionsSpec';
|
|
2
|
-
|
|
3
|
-
players: PlayersOptionsSpec<P>;
|
|
4
|
-
};
|
|
5
|
-
export default WithPlayerOptionsSpec;
|
|
1
|
+
import PlayersOptionsSpec from './PlayersOptionsSpec';
|
|
2
|
+
type WithPlayerOptionsSpec<P> = {
|
|
3
|
+
players: PlayersOptionsSpec<P>;
|
|
4
|
+
};
|
|
5
|
+
export default WithPlayerOptionsSpec;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
players: P[];
|
|
3
|
-
};
|
|
4
|
-
export default WithPlayersOptions;
|
|
1
|
+
type WithPlayersOptions<P> = {
|
|
2
|
+
players: P[];
|
|
3
|
+
};
|
|
4
|
+
export default WithPlayersOptions;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { TFunction } from 'i18next';
|
|
2
|
-
import OptionsSpec from './OptionsSpec';
|
|
3
|
-
import WithIdOption from './WithIdOption';
|
|
4
|
-
export default function getFallbackPlayerName<Id, P extends WithIdOption<Id>, Options>(id: Id, t: TFunction, optionsSpec?: OptionsSpec<Options>): string;
|
|
1
|
+
import { TFunction } from 'i18next';
|
|
2
|
+
import OptionsSpec from './OptionsSpec';
|
|
3
|
+
import WithIdOption from './WithIdOption';
|
|
4
|
+
export default function getFallbackPlayerName<Id, P extends WithIdOption<Id>, Options>(id: Id, t: TFunction, optionsSpec?: OptionsSpec<Options>): string;
|
|
@@ -1,16 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
else {
|
|
12
|
-
return t('Player {number}', { number: id });
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.default = getFallbackPlayerName;
|
|
1
|
+
import isWithPlayerIdOptions from './isWithPlayerIdOptions';
|
|
2
|
+
export default function getFallbackPlayerName(id, t, optionsSpec) {
|
|
3
|
+
if (optionsSpec && isWithPlayerIdOptions(optionsSpec)) {
|
|
4
|
+
return optionsSpec.players.id.valueSpec(id).label(t);
|
|
5
|
+
}
|
|
6
|
+
else {
|
|
7
|
+
return t('Player {number}', { number: id });
|
|
8
|
+
}
|
|
9
|
+
}
|
|
16
10
|
//# sourceMappingURL=getFallbackPlayerName.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getFallbackPlayerName.js","sourceRoot":"","sources":["../../src/options/getFallbackPlayerName.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getFallbackPlayerName.js","sourceRoot":"","sources":["../../src/options/getFallbackPlayerName.ts"],"names":[],"mappings":"AACA,OAAO,qBAAqB,MAAM,yBAAyB,CAAA;AAI3D,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAA0C,EAAM,EAAE,CAAY,EAAE,WAAkC;IAC7I,IAAI,WAAW,IAAI,qBAAqB,CAAiB,WAAW,CAAC,EAAE,CAAC;QACtE,OAAO,WAAW,CAAC,OAAO,CAAC,EAAE,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;IACtD,CAAC;SAAM,CAAC;QACN,OAAO,CAAC,CAAC,iBAAiB,EAAE,EAAC,MAAM,EAAE,EAAE,EAAC,CAAC,CAAA;IAC3C,CAAC;AACH,CAAC"}
|
package/dist/options/index.d.ts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export { default as OptionsSpec } from './OptionsSpec';
|
|
2
|
-
export { default as OptionSpecOf } from './OptionSpecOf';
|
|
3
|
-
export { default as Option } from './Option';
|
|
4
|
-
export { default as EnumOption } from './EnumOption';
|
|
5
|
-
export * from './EnumOption';
|
|
6
|
-
export { default as PlayersOptionsSpec } from './PlayersOptionsSpec';
|
|
7
|
-
export { default as PlayerIdSpec } from './PlayerIdSpec';
|
|
8
|
-
export { default as WithPlayersOptions } from './WithPlayersOptions';
|
|
9
|
-
export { default as WithIdOption } from './WithIdOption';
|
|
10
|
-
export { default as providePlayerIds } from './providePlayerIds';
|
|
11
|
-
export { default as isWithPlayerIdOptions } from './isWithPlayerIdOptions';
|
|
12
|
-
export { default as getFallbackPlayerName } from './getFallbackPlayerName';
|
|
13
|
-
export { default as OptionsValidationError } from './OptionsValidationError';
|
|
1
|
+
export { default as OptionsSpec } from './OptionsSpec';
|
|
2
|
+
export { default as OptionSpecOf } from './OptionSpecOf';
|
|
3
|
+
export { default as Option } from './Option';
|
|
4
|
+
export { default as EnumOption } from './EnumOption';
|
|
5
|
+
export * from './EnumOption';
|
|
6
|
+
export { default as PlayersOptionsSpec } from './PlayersOptionsSpec';
|
|
7
|
+
export { default as PlayerIdSpec } from './PlayerIdSpec';
|
|
8
|
+
export { default as WithPlayersOptions } from './WithPlayersOptions';
|
|
9
|
+
export { default as WithIdOption } from './WithIdOption';
|
|
10
|
+
export { default as providePlayerIds } from './providePlayerIds';
|
|
11
|
+
export { default as isWithPlayerIdOptions } from './isWithPlayerIdOptions';
|
|
12
|
+
export { default as getFallbackPlayerName } from './getFallbackPlayerName';
|
|
13
|
+
export { default as OptionsValidationError } from './OptionsValidationError';
|
package/dist/options/index.js
CHANGED
|
@@ -1,30 +1,6 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
17
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
18
|
-
};
|
|
19
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.OptionsValidationError = exports.getFallbackPlayerName = exports.isWithPlayerIdOptions = exports.providePlayerIds = void 0;
|
|
21
|
-
__exportStar(require("./EnumOption"), exports);
|
|
22
|
-
var providePlayerIds_1 = require("./providePlayerIds");
|
|
23
|
-
Object.defineProperty(exports, "providePlayerIds", { enumerable: true, get: function () { return __importDefault(providePlayerIds_1).default; } });
|
|
24
|
-
var isWithPlayerIdOptions_1 = require("./isWithPlayerIdOptions");
|
|
25
|
-
Object.defineProperty(exports, "isWithPlayerIdOptions", { enumerable: true, get: function () { return __importDefault(isWithPlayerIdOptions_1).default; } });
|
|
26
|
-
var getFallbackPlayerName_1 = require("./getFallbackPlayerName");
|
|
27
|
-
Object.defineProperty(exports, "getFallbackPlayerName", { enumerable: true, get: function () { return __importDefault(getFallbackPlayerName_1).default; } });
|
|
28
|
-
var OptionsValidationError_1 = require("./OptionsValidationError");
|
|
29
|
-
Object.defineProperty(exports, "OptionsValidationError", { enumerable: true, get: function () { return __importDefault(OptionsValidationError_1).default; } });
|
|
1
|
+
export * from './EnumOption';
|
|
2
|
+
export { default as providePlayerIds } from './providePlayerIds';
|
|
3
|
+
export { default as isWithPlayerIdOptions } from './isWithPlayerIdOptions';
|
|
4
|
+
export { default as getFallbackPlayerName } from './getFallbackPlayerName';
|
|
5
|
+
export { default as OptionsValidationError } from './OptionsValidationError';
|
|
30
6
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/options/index.ts"],"names":[],"mappings":"AAIA,cAAc,cAAc,CAAA;AAK5B,OAAO,EAAC,OAAO,IAAI,gBAAgB,EAAC,MAAM,oBAAoB,CAAA;AAC9D,OAAO,EAAC,OAAO,IAAI,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAC,OAAO,IAAI,qBAAqB,EAAC,MAAM,yBAAyB,CAAA;AACxE,OAAO,EAAC,OAAO,IAAI,sBAAsB,EAAC,MAAM,0BAA0B,CAAA"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import OptionsSpec from './OptionsSpec';
|
|
2
|
-
import WithIdOption from './WithIdOption';
|
|
3
|
-
import WithPlayerOptionsSpec from './WithPlayerOptionsSpec';
|
|
4
|
-
export default function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
|
|
1
|
+
import OptionsSpec from './OptionsSpec';
|
|
2
|
+
import WithIdOption from './WithIdOption';
|
|
3
|
+
import WithPlayerOptionsSpec from './WithPlayerOptionsSpec';
|
|
4
|
+
export default function isWithPlayerIdOptions<Id, P extends WithIdOption<Id>, Options>(optionsSpec: OptionsSpec<Options>): optionsSpec is OptionsSpec<Options> & WithPlayerOptionsSpec<P>;
|
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
return !!idOptions;
|
|
9
|
-
}
|
|
10
|
-
exports.default = isWithPlayerIdOptions;
|
|
1
|
+
export default function isWithPlayerIdOptions(optionsSpec) {
|
|
2
|
+
const playersOptions = optionsSpec.players;
|
|
3
|
+
if (!playersOptions)
|
|
4
|
+
return false;
|
|
5
|
+
const idOptions = playersOptions.id;
|
|
6
|
+
return !!idOptions;
|
|
7
|
+
}
|
|
11
8
|
//# sourceMappingURL=isWithPlayerIdOptions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"isWithPlayerIdOptions.js","sourceRoot":"","sources":["../../src/options/isWithPlayerIdOptions.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"isWithPlayerIdOptions.js","sourceRoot":"","sources":["../../src/options/isWithPlayerIdOptions.ts"],"names":[],"mappings":"AAKA,MAAM,CAAC,OAAO,UAAU,qBAAqB,CAA0C,WAAiC;IACtH,MAAM,cAAc,GAAI,WAA+D,CAAC,OAAO,CAAA;IAC/F,IAAI,CAAC,cAAc;QAAE,OAAO,KAAK,CAAA;IACjC,MAAM,SAAS,GAAI,cAA2D,CAAC,EAAE,CAAA;IACjF,OAAO,CAAC,CAAC,SAAS,CAAA;AACpB,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import WithIdOption from './WithIdOption';
|
|
2
|
-
import WithPlayersOptions from './WithPlayersOptions';
|
|
3
|
-
export default function providePlayerIds(players: number): number[];
|
|
4
|
-
export default function providePlayerIds<Options>(players: number, options: Options): number[];
|
|
5
|
-
export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: number, options: Options): Id[];
|
|
6
|
-
export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: (Id | null)[], options: Options): Id[];
|
|
1
|
+
import WithIdOption from './WithIdOption';
|
|
2
|
+
import WithPlayersOptions from './WithPlayersOptions';
|
|
3
|
+
export default function providePlayerIds(players: number): number[];
|
|
4
|
+
export default function providePlayerIds<Options>(players: number, options: Options): number[];
|
|
5
|
+
export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: number, options: Options): Id[];
|
|
6
|
+
export default function providePlayerIds<Id, Player extends WithIdOption<Id>, Options extends WithPlayersOptions<Player>>(players: (Id | null)[], options: Options): Id[];
|
|
@@ -1,38 +1,23 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
var potentialIndexes = result.map(function (id, index) { return ({ id: id, index: index }); }).filter(function (r) { return !mandatoryIds.includes(r.id); }).map(function (r) { return r.index; });
|
|
24
|
-
var index = potentialIndexes[Math.floor(Math.random() * potentialIndexes.length)];
|
|
25
|
-
result[index] = mandatoryId;
|
|
26
|
-
}
|
|
27
|
-
var potentialIds = (optionsSpec && (0, isWithPlayerIdOptions_1.default)(optionsSpec) ? (0, PlayerIdSpec_1.getAvailableIds)(optionsSpec.players.id, numberOfPlayers)
|
|
28
|
-
: Array.from(Array(numberOfPlayers).keys()).map(function (id) { return id + 1; }));
|
|
29
|
-
var remainingIds = potentialIds.filter(function (id) { return !result.includes(id); });
|
|
30
|
-
for (var i = 0; i < result.length; i++) {
|
|
31
|
-
if (result[i] === null || !potentialIds.includes(result[i])) {
|
|
32
|
-
result[i] = remainingIds.splice(Math.floor(Math.random() * remainingIds.length), 1)[0];
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
exports.default = providePlayerIds;
|
|
1
|
+
import isWithPlayerIdOptions from './isWithPlayerIdOptions';
|
|
2
|
+
import { getAvailableIds, getMandatoryIds } from './PlayerIdSpec';
|
|
3
|
+
export default function providePlayerIds(players, optionsSpec) {
|
|
4
|
+
const result = typeof players === 'number' ? Array(players).fill(null) : [...players];
|
|
5
|
+
const numberOfPlayers = typeof players === 'number' ? players : players.length;
|
|
6
|
+
const mandatoryIds = optionsSpec && isWithPlayerIdOptions(optionsSpec) ? getMandatoryIds(optionsSpec.players.id, numberOfPlayers) : [];
|
|
7
|
+
while (mandatoryIds.some(id => !result.includes(id))) {
|
|
8
|
+
const mandatoryId = mandatoryIds.find(id => !result.includes(id));
|
|
9
|
+
const potentialIndexes = result.map((id, index) => ({ id, index })).filter(r => !mandatoryIds.includes(r.id)).map(r => r.index);
|
|
10
|
+
const index = potentialIndexes[Math.floor(Math.random() * potentialIndexes.length)];
|
|
11
|
+
result[index] = mandatoryId;
|
|
12
|
+
}
|
|
13
|
+
const potentialIds = (optionsSpec && isWithPlayerIdOptions(optionsSpec) ? getAvailableIds(optionsSpec.players.id, numberOfPlayers)
|
|
14
|
+
: Array.from(Array(numberOfPlayers).keys()).map(id => id + 1));
|
|
15
|
+
const remainingIds = potentialIds.filter(id => !result.includes(id));
|
|
16
|
+
for (let i = 0; i < result.length; i++) {
|
|
17
|
+
if (result[i] === null || !potentialIds.includes(result[i])) {
|
|
18
|
+
result[i] = remainingIds.splice(Math.floor(Math.random() * remainingIds.length), 1)[0];
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
return result;
|
|
22
|
+
}
|
|
38
23
|
//# sourceMappingURL=providePlayerIds.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providePlayerIds.js","sourceRoot":"","sources":["../../src/options/providePlayerIds.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"providePlayerIds.js","sourceRoot":"","sources":["../../src/options/providePlayerIds.ts"],"names":[],"mappings":"AAAA,OAAO,qBAAqB,MAAM,yBAAyB,CAAA;AAE3D,OAAO,EAAC,eAAe,EAAE,eAAe,EAAC,MAAM,gBAAgB,CAAA;AAS/D,MAAM,CAAC,OAAO,UAAU,gBAAgB,CAAc,OAA+B,EAAE,WAA8B;IACnH,MAAM,MAAM,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAA;IAErF,MAAM,eAAe,GAAG,OAAO,OAAO,KAAK,QAAQ,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAA;IAE9E,MAAM,YAAY,GAAG,WAAW,IAAI,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,CAAA;IACtI,OAAO,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC;QACrD,MAAM,WAAW,GAAG,YAAY,CAAC,IAAI,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAE,CAAA;QAClE,MAAM,gBAAgB,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CAAC,EAAC,EAAE,EAAE,KAAK,EAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,YAAY,CAAC,QAAQ,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAA;QAC7H,MAAM,KAAK,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC,CAAA;QACnF,MAAM,CAAC,KAAK,CAAC,GAAG,WAAW,CAAA;IAC7B,CAAC;IAED,MAAM,YAAY,GAAG,CAAC,WAAW,IAAI,qBAAqB,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,eAAe,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE,eAAe,CAAC;QAChI,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,CAAC,CAAC,CAAS,CAAA;IACxE,MAAM,YAAY,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAA;IACpE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,MAAM,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,EAAE,CAAC;YAC5D,MAAM,CAAC,CAAC,CAAC,GAAG,YAAY,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAA;QACxF,CAAC;IACH,CAAC;IAED,OAAO,MAAM,CAAA;AACf,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare function isEnumValue<T>(value: string | T): value is T;
|
|
1
|
+
export declare function isEnumValue<T>(value: string | T): value is T;
|
package/dist/utils/EnumUtils.js
CHANGED
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
function isEnumValue(value) {
|
|
5
|
-
return typeof value !== 'string';
|
|
6
|
-
}
|
|
7
|
-
exports.isEnumValue = isEnumValue;
|
|
1
|
+
export function isEnumValue(value) {
|
|
2
|
+
return typeof value !== 'string';
|
|
3
|
+
}
|
|
8
4
|
//# sourceMappingURL=EnumUtils.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"EnumUtils.js","sourceRoot":"","sources":["../../src/utils/EnumUtils.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"EnumUtils.js","sourceRoot":"","sources":["../../src/utils/EnumUtils.ts"],"names":[],"mappings":"AAAA,MAAM,UAAU,WAAW,CAAI,KAAiB;IAC9C,OAAO,OAAO,KAAK,KAAK,QAAQ,CAAA;AAClC,CAAC"}
|
package/dist/utils/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export * from './EnumUtils';
|
|
1
|
+
export * from './EnumUtils';
|
package/dist/utils/index.js
CHANGED
|
@@ -1,18 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
-
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
-
};
|
|
16
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
-
__exportStar(require("./EnumUtils"), exports);
|
|
1
|
+
export * from './EnumUtils';
|
|
18
2
|
//# sourceMappingURL=index.js.map
|
package/dist/utils/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAA"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@gamepark/rules-api",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.24.0",
|
|
4
4
|
"description": "API to implement the rules of a board game",
|
|
5
|
+
"type": "module",
|
|
5
6
|
"main": "dist/index.js",
|
|
6
7
|
"types": "dist/index.d.ts",
|
|
7
8
|
"files": [
|
|
@@ -27,5 +28,5 @@
|
|
|
27
28
|
"devDependencies": {
|
|
28
29
|
"i18next": ">=21.3.0"
|
|
29
30
|
},
|
|
30
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "3fc47f97f33081fea53472ecabfbad3abfbe0f3e"
|
|
31
32
|
}
|