jl-sprt-match 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/engines/types.d.ts +0 -0
- package/dist/engines/types.js +2 -0
- package/dist/engines/types.js.map +1 -0
- package/dist/index.d.ts +26 -0
- package/dist/index.js +44 -0
- package/dist/index.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballMatch.d.ts +13 -0
- package/dist/profiles/americanFootball/AmericanFootballMatch.js +21 -0
- package/dist/profiles/americanFootball/AmericanFootballMatch.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballMatchPlay.d.ts +84 -0
- package/dist/profiles/americanFootball/AmericanFootballMatchPlay.js +273 -0
- package/dist/profiles/americanFootball/AmericanFootballMatchPlay.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballProfile.d.ts +20 -0
- package/dist/profiles/americanFootball/AmericanFootballProfile.js +50 -0
- package/dist/profiles/americanFootball/AmericanFootballProfile.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballResult.d.ts +14 -0
- package/dist/profiles/americanFootball/AmericanFootballResult.js +94 -0
- package/dist/profiles/americanFootball/AmericanFootballResult.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballRoster.d.ts +3 -0
- package/dist/profiles/americanFootball/AmericanFootballRoster.js +8 -0
- package/dist/profiles/americanFootball/AmericanFootballRoster.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballScore.d.ts +8 -0
- package/dist/profiles/americanFootball/AmericanFootballScore.js +3 -0
- package/dist/profiles/americanFootball/AmericanFootballScore.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballSerie.d.ts +21 -0
- package/dist/profiles/americanFootball/AmericanFootballSerie.js +64 -0
- package/dist/profiles/americanFootball/AmericanFootballSerie.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballTeam.d.ts +6 -0
- package/dist/profiles/americanFootball/AmericanFootballTeam.js +15 -0
- package/dist/profiles/americanFootball/AmericanFootballTeam.js.map +1 -0
- package/dist/profiles/americanFootball/AmericanFootballTeamTableItem.d.ts +36 -0
- package/dist/profiles/americanFootball/AmericanFootballTeamTableItem.js +65 -0
- package/dist/profiles/americanFootball/AmericanFootballTeamTableItem.js.map +1 -0
- package/dist/profiles/football/FootballMatch.d.ts +13 -0
- package/dist/profiles/football/FootballMatch.js +21 -0
- package/dist/profiles/football/FootballMatch.js.map +1 -0
- package/dist/profiles/football/FootballMatchPlay.d.ts +70 -0
- package/dist/profiles/football/FootballMatchPlay.js +265 -0
- package/dist/profiles/football/FootballMatchPlay.js.map +1 -0
- package/dist/profiles/football/FootballProfile.d.ts +20 -0
- package/dist/profiles/football/FootballProfile.js +50 -0
- package/dist/profiles/football/FootballProfile.js.map +1 -0
- package/dist/profiles/football/FootballResult.d.ts +14 -0
- package/dist/profiles/football/FootballResult.js +72 -0
- package/dist/profiles/football/FootballResult.js.map +1 -0
- package/dist/profiles/football/FootballRoster.d.ts +3 -0
- package/dist/profiles/football/FootballRoster.js +8 -0
- package/dist/profiles/football/FootballRoster.js.map +1 -0
- package/dist/profiles/football/FootballScore.d.ts +4 -0
- package/dist/profiles/football/FootballScore.js +3 -0
- package/dist/profiles/football/FootballScore.js.map +1 -0
- package/dist/profiles/football/FootballSerie.d.ts +16 -0
- package/dist/profiles/football/FootballSerie.js +57 -0
- package/dist/profiles/football/FootballSerie.js.map +1 -0
- package/dist/profiles/football/FootballTeam.d.ts +6 -0
- package/dist/profiles/football/FootballTeam.js +15 -0
- package/dist/profiles/football/FootballTeam.js.map +1 -0
- package/dist/profiles/football/FootballTeamTableItem.d.ts +36 -0
- package/dist/profiles/football/FootballTeamTableItem.js +65 -0
- package/dist/profiles/football/FootballTeamTableItem.js.map +1 -0
- package/dist/profiles/types.d.ts +4 -0
- package/dist/profiles/types.js +3 -0
- package/dist/profiles/types.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballMatch.d.ts +14 -0
- package/dist/profiles/volleyball/VolleyballMatch.js +22 -0
- package/dist/profiles/volleyball/VolleyballMatch.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballMatchPlay.d.ts +43 -0
- package/dist/profiles/volleyball/VolleyballMatchPlay.js +234 -0
- package/dist/profiles/volleyball/VolleyballMatchPlay.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballProfile.d.ts +22 -0
- package/dist/profiles/volleyball/VolleyballProfile.js +77 -0
- package/dist/profiles/volleyball/VolleyballProfile.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballResult.d.ts +29 -0
- package/dist/profiles/volleyball/VolleyballResult.js +93 -0
- package/dist/profiles/volleyball/VolleyballResult.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballRoster.d.ts +3 -0
- package/dist/profiles/volleyball/VolleyballRoster.js +8 -0
- package/dist/profiles/volleyball/VolleyballRoster.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballScore.d.ts +5 -0
- package/dist/profiles/volleyball/VolleyballScore.js +3 -0
- package/dist/profiles/volleyball/VolleyballScore.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballSerie.d.ts +25 -0
- package/dist/profiles/volleyball/VolleyballSerie.js +82 -0
- package/dist/profiles/volleyball/VolleyballSerie.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballTeam.d.ts +6 -0
- package/dist/profiles/volleyball/VolleyballTeam.js +15 -0
- package/dist/profiles/volleyball/VolleyballTeam.js.map +1 -0
- package/dist/profiles/volleyball/VolleyballTeamTableItem.d.ts +47 -0
- package/dist/profiles/volleyball/VolleyballTeamTableItem.js +73 -0
- package/dist/profiles/volleyball/VolleyballTeamTableItem.js.map +1 -0
- package/dist/randomSource.d.ts +10 -0
- package/dist/randomSource.js +32 -0
- package/dist/randomSource.js.map +1 -0
- package/package.json +32 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolleyballRoster = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
class VolleyballRoster extends jl_sprt_core_1.A_TeamRoster {
|
|
6
|
+
}
|
|
7
|
+
exports.VolleyballRoster = VolleyballRoster;
|
|
8
|
+
//# sourceMappingURL=VolleyballRoster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolleyballRoster.js","sourceRoot":"","sources":["../../../src/profiles/volleyball/VolleyballRoster.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAE5C,MAAa,gBAAiB,SAAQ,2BAAY;CAAG;AAArD,4CAAqD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolleyballScore.js","sourceRoot":"","sources":["../../../src/profiles/volleyball/VolleyballScore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { A_Serie, IVolleyballScore, ISerieCreationInfo } from 'jl-sprt-core';
|
|
2
|
+
import { VolleyballRoster } from './VolleyballRoster';
|
|
3
|
+
import { VolleyballTeam } from './VolleyballTeam';
|
|
4
|
+
export interface IVolleyballSerieCreationInfo extends ISerieCreationInfo<VolleyballRoster> {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Serie de volleyball.
|
|
8
|
+
* MatchScoreType: IVolleyScore (sets + puntos por set)
|
|
9
|
+
* SerieScoreType: number (puntos de partido acumulados)
|
|
10
|
+
*
|
|
11
|
+
* Se juegan dos partidos. Puntos de partido:
|
|
12
|
+
* - Victoria 3-0 o 3-1: 3 puntos ganador, 0 perdedor
|
|
13
|
+
* - Victoria 3-2: 2 puntos ganador, 1 perdedor
|
|
14
|
+
*
|
|
15
|
+
* Si hay empate en puntos de partido tras ambos matches,
|
|
16
|
+
* se juega un Golden Set (set único a 15 puntos, diferencia mínima de 2).
|
|
17
|
+
*
|
|
18
|
+
* TODO: Implementar lógica de Golden Set cuando se necesite.
|
|
19
|
+
*/
|
|
20
|
+
export declare class VolleyballSerie extends A_Serie<IVolleyballScore, VolleyballRoster> {
|
|
21
|
+
constructor(info: IVolleyballSerieCreationInfo);
|
|
22
|
+
get isFinished(): boolean;
|
|
23
|
+
get winner(): VolleyballTeam;
|
|
24
|
+
get loser(): VolleyballTeam;
|
|
25
|
+
}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolleyballSerie = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const VolleyballMatch_1 = require("./VolleyballMatch");
|
|
6
|
+
/**
|
|
7
|
+
* Serie de volleyball.
|
|
8
|
+
* MatchScoreType: IVolleyScore (sets + puntos por set)
|
|
9
|
+
* SerieScoreType: number (puntos de partido acumulados)
|
|
10
|
+
*
|
|
11
|
+
* Se juegan dos partidos. Puntos de partido:
|
|
12
|
+
* - Victoria 3-0 o 3-1: 3 puntos ganador, 0 perdedor
|
|
13
|
+
* - Victoria 3-2: 2 puntos ganador, 1 perdedor
|
|
14
|
+
*
|
|
15
|
+
* Si hay empate en puntos de partido tras ambos matches,
|
|
16
|
+
* se juega un Golden Set (set único a 15 puntos, diferencia mínima de 2).
|
|
17
|
+
*
|
|
18
|
+
* TODO: Implementar lógica de Golden Set cuando se necesite.
|
|
19
|
+
*/
|
|
20
|
+
class VolleyballSerie extends jl_sprt_core_1.A_Serie {
|
|
21
|
+
constructor(info) {
|
|
22
|
+
super(info, (mci) => { return new VolleyballMatch_1.VolleyballMatch(mci); });
|
|
23
|
+
}
|
|
24
|
+
get isFinished() {
|
|
25
|
+
return this._matches.every((m) => m.isFinished);
|
|
26
|
+
}
|
|
27
|
+
get winner() {
|
|
28
|
+
if (!this.isFinished)
|
|
29
|
+
throw new Error('La serie todavía no terminó');
|
|
30
|
+
const results = this.getResults();
|
|
31
|
+
/*
|
|
32
|
+
* Serie de un solo partido.
|
|
33
|
+
*/
|
|
34
|
+
if (results.length === 1) {
|
|
35
|
+
const winnerId = results[0].getWinnerInfo().teamWinner;
|
|
36
|
+
if (winnerId === this.teamOne.id)
|
|
37
|
+
return this.teamOne;
|
|
38
|
+
if (winnerId === this.teamTwo.id)
|
|
39
|
+
return this.teamTwo;
|
|
40
|
+
throw new Error('No hubo ganador en la serie de volleyball');
|
|
41
|
+
}
|
|
42
|
+
/*
|
|
43
|
+
* Actualmente solo soportamos series de ida y vuelta.
|
|
44
|
+
*/
|
|
45
|
+
if (results.length !== 2)
|
|
46
|
+
throw new Error('Unsupported volleyball series');
|
|
47
|
+
const firstWinner = results[0].getWinnerInfo().teamWinner;
|
|
48
|
+
const secondWinner = results[1].getWinnerInfo().teamWinner;
|
|
49
|
+
/*
|
|
50
|
+
* Un equipo ganó ambos partidos.
|
|
51
|
+
*/
|
|
52
|
+
if (firstWinner === secondWinner) {
|
|
53
|
+
if (firstWinner === this.teamOne.id)
|
|
54
|
+
return this.teamOne;
|
|
55
|
+
if (firstWinner === this.teamTwo.id)
|
|
56
|
+
return this.teamTwo;
|
|
57
|
+
}
|
|
58
|
+
/*
|
|
59
|
+
* Cada equipo ganó un partido.
|
|
60
|
+
*
|
|
61
|
+
* La serie debe haberse resuelto mediante el set extra
|
|
62
|
+
* del segundo partido.
|
|
63
|
+
*/
|
|
64
|
+
if (firstWinner !== 'none' && secondWinner !== 'none' && firstWinner !== secondWinner) {
|
|
65
|
+
const secondResult = results[1];
|
|
66
|
+
const teamOneExtra = secondResult.getScore(this.teamOne.id).extraSetPoints;
|
|
67
|
+
const teamTwoExtra = secondResult.getScore(this.teamTwo.id).extraSetPoints;
|
|
68
|
+
if (teamOneExtra !== undefined && teamTwoExtra !== undefined) {
|
|
69
|
+
if (teamOneExtra > teamTwoExtra)
|
|
70
|
+
return this.teamOne;
|
|
71
|
+
if (teamTwoExtra > teamOneExtra)
|
|
72
|
+
return this.teamTwo;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
throw new Error('No hubo ganador en la serie de volleyball');
|
|
76
|
+
}
|
|
77
|
+
get loser() {
|
|
78
|
+
return (this.winner.id === this._teamTwo.id) ? this.teamOne : this.teamTwo;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
exports.VolleyballSerie = VolleyballSerie;
|
|
82
|
+
//# sourceMappingURL=VolleyballSerie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolleyballSerie.js","sourceRoot":"","sources":["../../../src/profiles/volleyball/VolleyballSerie.ts"],"names":[],"mappings":";;;AACA,+CAA4H;AAG5H,uDAAkF;AAKlF;;;;;;;;;;;;;GAaG;AACH,MAAa,eAAgB,SAAQ,sBAA2C;IAE9E,YAAY,IAAkC;QAC5C,KAAK,CAAC,IAAI,EAAE,CAAC,GAAiC,EAAE,EAAE,GAAG,OAAO,IAAI,iCAAe,CAAC,GAAG,CAAC,CAAA,CAAC,CAAC,CAAC,CAAC;IAC1F,CAAC;IAED,IAAI,UAAU;QACZ,OAAO,IAAI,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC;IAClD,CAAC;IAED,IAAI,MAAM;QACR,IAAI,CAAC,IAAI,CAAC,UAAU;YAClB,MAAM,IAAI,KAAK,CAAC,6BAA6B,CAAC,CAAC;QAEjD,MAAM,OAAO,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;QAClC;;WAEG;QACH,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC,aAAa,EAAE,CAAC,UAAU,CAAC;YAEvD,IAAI,QAAQ,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE;gBAC9B,OAAO,IAAI,CAAC,OAAO,CAAC;YAEtB,IAAI,QAAQ,KAAK,IAAI,CAAC,OAAO,CAAC,EAAE;gBAC9B,OAAO,IAAI,CAAC,OAAO,CAAC;YAEtB,MAAM,IAAI,KAAK,CA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AAI,KAAK;QACP,OAAO,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IAC7E,CAAC;CACF;AA9ED,0CA8EC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolleyballTeam = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const VolleyballRoster_1 = require("./VolleyballRoster");
|
|
6
|
+
class VolleyballTeam extends jl_sprt_core_1.A_Team {
|
|
7
|
+
constructor(itc) {
|
|
8
|
+
super(itc);
|
|
9
|
+
}
|
|
10
|
+
getTeamMatch() {
|
|
11
|
+
return new VolleyballRoster_1.VolleyballRoster(this.id);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.VolleyballTeam = VolleyballTeam;
|
|
15
|
+
//# sourceMappingURL=VolleyballTeam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolleyballTeam.js","sourceRoot":"","sources":["../../../src/profiles/volleyball/VolleyballTeam.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AACpD,yDAAsD;AAEtD,MAAa,cAAe,SAAQ,qBAAwB;IAC1D,YAAY,GAAiB;QAC3B,KAAK,CAAC,GAAG,CAAC,CAAA;IACZ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,mCAAgB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IACvC,CAAC;CACF;AARD,wCAQC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { A_TeamTableItem, AnyTeamTableItem, IA_TeamTableItemBase, SortFunc } from "jl-sprt-core";
|
|
2
|
+
import { VolleyballTeam } from './VolleyballTeam';
|
|
3
|
+
export type VolleyballMatchResults = 'W3_0' | 'W3_1' | 'W3_2' | 'L2_3' | 'L1_3' | 'L0_3';
|
|
4
|
+
export type VolleyballMatchPuntuations = 'sw' | 'sl' | 'pf' | 'pa';
|
|
5
|
+
export type IVolleyballTeamTableItem = IA_TeamTableItemBase & {
|
|
6
|
+
W3_0: number;
|
|
7
|
+
W3_1: number;
|
|
8
|
+
W3_2: number;
|
|
9
|
+
L2_3: number;
|
|
10
|
+
L1_3: number;
|
|
11
|
+
L0_3: number;
|
|
12
|
+
sw: number;
|
|
13
|
+
sl: number;
|
|
14
|
+
pf: number;
|
|
15
|
+
pa: number;
|
|
16
|
+
sd: number;
|
|
17
|
+
pd: number;
|
|
18
|
+
};
|
|
19
|
+
export declare class VolleyballTeamTableItem extends A_TeamTableItem<VolleyballMatchResults, VolleyballMatchPuntuations> {
|
|
20
|
+
constructor(t: VolleyballTeam, bsId: string);
|
|
21
|
+
get ps(): number;
|
|
22
|
+
getInitialCountOfMathResults(): {
|
|
23
|
+
[k in VolleyballMatchResults]: number;
|
|
24
|
+
};
|
|
25
|
+
getInitialCountOfMathPuntuations(): {
|
|
26
|
+
[k in VolleyballMatchPuntuations]: number;
|
|
27
|
+
};
|
|
28
|
+
get sw(): number;
|
|
29
|
+
get sl(): number;
|
|
30
|
+
get pf(): number;
|
|
31
|
+
get pa(): number;
|
|
32
|
+
get sd(): number;
|
|
33
|
+
get pd(): number;
|
|
34
|
+
addSw(s: number): void;
|
|
35
|
+
addSl(s: number): void;
|
|
36
|
+
addPf(p: number): void;
|
|
37
|
+
addPa(p: number): void;
|
|
38
|
+
addW3_0(): void;
|
|
39
|
+
addW3_1(): void;
|
|
40
|
+
addW3_2(): void;
|
|
41
|
+
addL2_3(): void;
|
|
42
|
+
addL1_3(): void;
|
|
43
|
+
addL0_3(): void;
|
|
44
|
+
getSortFunc(): SortFunc<AnyTeamTableItem>;
|
|
45
|
+
getInterface(): IVolleyballTeamTableItem;
|
|
46
|
+
}
|
|
47
|
+
export declare const VolleyballSortFunc: SortFunc<VolleyballTeamTableItem>;
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VolleyballSortFunc = exports.VolleyballTeamTableItem = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
class VolleyballTeamTableItem extends jl_sprt_core_1.A_TeamTableItem {
|
|
6
|
+
constructor(t, bsId) {
|
|
7
|
+
super(t, bsId);
|
|
8
|
+
}
|
|
9
|
+
get ps() {
|
|
10
|
+
const r = this.matchResults;
|
|
11
|
+
return 3 * r.W3_0 + 3 * r.W3_1 + 2 * r.W3_2 + 1 * r.L2_3;
|
|
12
|
+
}
|
|
13
|
+
getInitialCountOfMathResults() {
|
|
14
|
+
return { W3_0: 0, W3_1: 0, W3_2: 0, L2_3: 0, L1_3: 0, L0_3: 0 };
|
|
15
|
+
}
|
|
16
|
+
getInitialCountOfMathPuntuations() {
|
|
17
|
+
return { sw: 0, sl: 0, pf: 0, pa: 0 };
|
|
18
|
+
}
|
|
19
|
+
// get W3(): number { return this.matchResults.W3_0 + this.matchResults.W3_1 }
|
|
20
|
+
// get W2(): number { return this.matchResults.W3_2 }
|
|
21
|
+
// get L1(): number { return this.matchResults.L2_3 }
|
|
22
|
+
// get L0(): number { return this.matchResults.L1_3 + this.matchResults.L0_3 }
|
|
23
|
+
get sw() { return this.matchPuntuations.sw; }
|
|
24
|
+
get sl() { return this.matchPuntuations.sl; }
|
|
25
|
+
get pf() { return this.matchPuntuations.pf; }
|
|
26
|
+
get pa() { return this.matchPuntuations.pa; }
|
|
27
|
+
get sd() { return this.sw - this.sl; }
|
|
28
|
+
get pd() { return this.pf - this.pa; }
|
|
29
|
+
addSw(s) { this.matchPuntuations.sw += s; }
|
|
30
|
+
addSl(s) { this.matchPuntuations.sl += s; }
|
|
31
|
+
addPf(p) { this.matchPuntuations.pf += p; }
|
|
32
|
+
addPa(p) { this.matchPuntuations.pa += p; }
|
|
33
|
+
addW3_0() { this.addMatchResult('W3_0'); }
|
|
34
|
+
addW3_1() { this.addMatchResult('W3_1'); }
|
|
35
|
+
addW3_2() { this.addMatchResult('W3_2'); }
|
|
36
|
+
addL2_3() { this.addMatchResult('L2_3'); }
|
|
37
|
+
addL1_3() { this.addMatchResult('L1_3'); }
|
|
38
|
+
addL0_3() { this.addMatchResult('L0_3'); }
|
|
39
|
+
getSortFunc() {
|
|
40
|
+
return exports.VolleyballSortFunc;
|
|
41
|
+
}
|
|
42
|
+
getInterface() {
|
|
43
|
+
return {
|
|
44
|
+
...super.getInterface(),
|
|
45
|
+
W3_0: this.matchResults.W3_0, W3_1: this.matchResults.W3_1, W3_2: this.matchResults.W3_2,
|
|
46
|
+
L2_3: this.matchResults.L2_3, L1_3: this.matchResults.L1_3, L0_3: this.matchResults.L0_3,
|
|
47
|
+
sw: this.sw, sl: this.sl, pf: this.pf, pa: this.pa,
|
|
48
|
+
sd: this.sd, pd: this.pd, /*W: this.W, L: this.L,*/
|
|
49
|
+
};
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
exports.VolleyballTeamTableItem = VolleyballTeamTableItem;
|
|
53
|
+
const VolleyballSortFunc = (a, b, isSE) => {
|
|
54
|
+
if (isSE) {
|
|
55
|
+
if (a.P - b.P !== 0)
|
|
56
|
+
return b.P - a.P;
|
|
57
|
+
}
|
|
58
|
+
if (b.pos - a.pos !== 0)
|
|
59
|
+
return a.pos - b.pos;
|
|
60
|
+
if (!isSE) {
|
|
61
|
+
if (a.pm - b.pm !== 0)
|
|
62
|
+
return b.pm - a.pm;
|
|
63
|
+
}
|
|
64
|
+
if (a.ps - b.ps !== 0)
|
|
65
|
+
return b.ps - a.ps;
|
|
66
|
+
if (a.sd - b.sd !== 0)
|
|
67
|
+
return b.sd - a.sd;
|
|
68
|
+
if (a.sw - b.sw !== 0)
|
|
69
|
+
return b.sw - a.sw;
|
|
70
|
+
return b.pd - a.pd;
|
|
71
|
+
};
|
|
72
|
+
exports.VolleyballSortFunc = VolleyballSortFunc;
|
|
73
|
+
//# sourceMappingURL=VolleyballTeamTableItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"VolleyballTeamTableItem.js","sourceRoot":"","sources":["../../../src/profiles/volleyball/VolleyballTeamTableItem.ts"],"names":[],"mappings":";;;AACA,+CAAiG;AAajG,MAAa,uBAAwB,SAAQ,8BAAmE;IAE9G,YAAY,CAAiB,EAAE,IAAY;QACzC,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,EAAE;QACJ,MAAM,CAAC,GAAG,IAAI,CAAC,YAAY,CAAC;QAC5B,OAAO,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,GAAG,CAAC,CAAC,IAAI,CAAC;IAC3D,CAAC;IAED,4BAA4B;QAC1B,OAAO,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,CAAC;IAClE,CAAC;IAED,gCAAgC;QAC9B,OAAO,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,EAAE,EAAE,CAAC,EAAE,CAAC;IACxC,CAAC;IAED,8EAA8E;IAC9E,qDAAqD;IACrD,qDAAqD;IACrD,8EAA8E;IAE9E,IAAI,EAAE,KAAa,OAAO,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAA,CAAC,CAAC;IACpD,IAAI,EAAE,KAAa,OAAO,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAA,CAAC,CAAC;IACpD,IAAI,EAAE,KAAa,OAAO,IAAI,CAAC,gBAAgB,CAAC,EAAE,CAAA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AAG,CAAC,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC1C,IAAI,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;IAC1C,OAAO,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC;AACrB,CAAC,CAAC;AAZW,QAAA,kBAAkB,sBAY7B"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Devuelve un número pseudoaleatorio en el rango [0, 1).
|
|
3
|
+
* Reemplaza a Math.random() en la simulación, permitiendo reproducibilidad.
|
|
4
|
+
*/
|
|
5
|
+
export declare function randomFloat(): number;
|
|
6
|
+
/**
|
|
7
|
+
* Reinicia la fuente de aleatoriedad con una semilla determinada.
|
|
8
|
+
* La misma semilla produce siempre la misma secuencia (útil para tests).
|
|
9
|
+
*/
|
|
10
|
+
export declare function reseedRandom(seed: number): void;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reseedRandom = exports.randomFloat = void 0;
|
|
4
|
+
const jl_utlts_1 = require("jl-utlts");
|
|
5
|
+
/**
|
|
6
|
+
* Fuente de aleatoriedad compartida para la simulación de partidos.
|
|
7
|
+
*
|
|
8
|
+
* Envuelve el generador determinista de jl-utlts (RandomNumberGenerator).
|
|
9
|
+
* Por defecto se siembra con una semilla basada en el tiempo actual, de modo
|
|
10
|
+
* que el comportamiento es efectivamente aleatorio en ejecución normal.
|
|
11
|
+
*
|
|
12
|
+
* Para tests reproducibles, llamar `reseedRandom(seed)` antes de simular:
|
|
13
|
+
* la misma semilla siempre produce la misma secuencia de resultados.
|
|
14
|
+
*/
|
|
15
|
+
let _randomFloat = jl_utlts_1.RandomNumberGenerator.makeRandomFloat(Date.now());
|
|
16
|
+
/**
|
|
17
|
+
* Devuelve un número pseudoaleatorio en el rango [0, 1).
|
|
18
|
+
* Reemplaza a Math.random() en la simulación, permitiendo reproducibilidad.
|
|
19
|
+
*/
|
|
20
|
+
function randomFloat() {
|
|
21
|
+
return _randomFloat();
|
|
22
|
+
}
|
|
23
|
+
exports.randomFloat = randomFloat;
|
|
24
|
+
/**
|
|
25
|
+
* Reinicia la fuente de aleatoriedad con una semilla determinada.
|
|
26
|
+
* La misma semilla produce siempre la misma secuencia (útil para tests).
|
|
27
|
+
*/
|
|
28
|
+
function reseedRandom(seed) {
|
|
29
|
+
_randomFloat = jl_utlts_1.RandomNumberGenerator.makeRandomFloat(seed);
|
|
30
|
+
}
|
|
31
|
+
exports.reseedRandom = reseedRandom;
|
|
32
|
+
//# sourceMappingURL=randomSource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"randomSource.js","sourceRoot":"","sources":["../src/randomSource.ts"],"names":[],"mappings":";;;AAAA,uCAAiD;AAEjD;;;;;;;;;GASG;AACH,IAAI,YAAY,GAAiB,gCAAqB,CAAC,eAAe,CAAC,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;AAEnF;;;GAGG;AACH,SAAgB,WAAW;IAC1B,OAAO,YAAY,EAAE,CAAC;AACvB,CAAC;AAFD,kCAEC;AAED;;;GAGG;AACH,SAAgB,YAAY,CAAC,IAAY;IACxC,YAAY,GAAG,gCAAqB,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;AAC5D,CAAC;AAFD,oCAEC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "jl-sprt-match",
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"scripts": {
|
|
11
|
+
"build": "npm run clean && tsc",
|
|
12
|
+
"clean": "node ./scripts/clean.js",
|
|
13
|
+
"clean:all": "node ./scripts/clean.js --all",
|
|
14
|
+
"dev:tsc": "tsc --watch",
|
|
15
|
+
"dev:nodemon": "nodemon ./dist/index.js ",
|
|
16
|
+
"test": "vitest",
|
|
17
|
+
"start": "node ./dist/index.js",
|
|
18
|
+
"prepublishOnly": "npm run build"
|
|
19
|
+
},
|
|
20
|
+
"author": "JELimaR",
|
|
21
|
+
"license": "ISC",
|
|
22
|
+
"devDependencies": {
|
|
23
|
+
"@types/node": "^22.10.0",
|
|
24
|
+
"nodemon": "^3.1.14",
|
|
25
|
+
"typescript": "~5.4.5",
|
|
26
|
+
"vitest": "^5.0.0"
|
|
27
|
+
},
|
|
28
|
+
"dependencies": {
|
|
29
|
+
"jl-sprt-core": "^1.1.4",
|
|
30
|
+
"jl-utlts": "^1.4.0"
|
|
31
|
+
}
|
|
32
|
+
}
|