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,94 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballResult = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const startScore = () => {
|
|
6
|
+
return {
|
|
7
|
+
totalPoints: 0,
|
|
8
|
+
touchdowns: 0,
|
|
9
|
+
extraPoints: 0,
|
|
10
|
+
twoPointConversions: 0,
|
|
11
|
+
fieldGoals: 0,
|
|
12
|
+
safeties: 0,
|
|
13
|
+
};
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Resultado de un partido de fútbol.
|
|
17
|
+
* Score: number (goles). El ganador es quien tiene mayor cantidad de goles.
|
|
18
|
+
*/
|
|
19
|
+
class AmericanFootballResult extends jl_sprt_core_1.A_Result {
|
|
20
|
+
constructor(one, two) {
|
|
21
|
+
super(one, two, startScore);
|
|
22
|
+
}
|
|
23
|
+
addScore(id, update) {
|
|
24
|
+
const score = id === this._teamOneScore.team
|
|
25
|
+
? this._teamOneScore.score
|
|
26
|
+
: id === this._teamTwoScore.team
|
|
27
|
+
? this._teamTwoScore.score
|
|
28
|
+
: undefined;
|
|
29
|
+
if (!score)
|
|
30
|
+
throw new Error(`Team ${id} not found`);
|
|
31
|
+
switch (update) {
|
|
32
|
+
case 'touchdown':
|
|
33
|
+
score.touchdowns++;
|
|
34
|
+
score.totalPoints += 6;
|
|
35
|
+
break;
|
|
36
|
+
case 'fieldGoal':
|
|
37
|
+
score.fieldGoals++;
|
|
38
|
+
score.totalPoints += 3;
|
|
39
|
+
break;
|
|
40
|
+
case 'extraPoint':
|
|
41
|
+
score.extraPoints++;
|
|
42
|
+
score.totalPoints += 1;
|
|
43
|
+
break;
|
|
44
|
+
case 'twoPointConversion':
|
|
45
|
+
score.twoPointConversions++;
|
|
46
|
+
score.totalPoints += 2;
|
|
47
|
+
break;
|
|
48
|
+
case 'safety':
|
|
49
|
+
score.safeties++;
|
|
50
|
+
score.totalPoints += 2;
|
|
51
|
+
break;
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
getScore(id) {
|
|
55
|
+
if (id === this._teamOneScore.team) {
|
|
56
|
+
return this._teamOneScore.score;
|
|
57
|
+
}
|
|
58
|
+
else if (id === this._teamTwoScore.team) {
|
|
59
|
+
return this._teamTwoScore.score;
|
|
60
|
+
}
|
|
61
|
+
else {
|
|
62
|
+
throw new Error(`en get score`);
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
getResultInfo() {
|
|
66
|
+
const pointsOne = this._teamOneScore.score.totalPoints;
|
|
67
|
+
const pointsTwo = this._teamTwoScore.score.totalPoints;
|
|
68
|
+
const winner = pointsOne > pointsTwo
|
|
69
|
+
? this._teamOneScore.team
|
|
70
|
+
: pointsTwo > pointsOne
|
|
71
|
+
? this._teamTwoScore.team
|
|
72
|
+
: 'none';
|
|
73
|
+
const loser = pointsOne < pointsTwo
|
|
74
|
+
? this._teamOneScore.team
|
|
75
|
+
: pointsTwo < pointsOne
|
|
76
|
+
? this._teamTwoScore.team
|
|
77
|
+
: 'none';
|
|
78
|
+
return {
|
|
79
|
+
teamOneScore: this._teamOneScore,
|
|
80
|
+
teamTwoScore: this._teamTwoScore,
|
|
81
|
+
teamWinner: winner,
|
|
82
|
+
teamLoser: loser,
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
getWinnerInfo() {
|
|
86
|
+
const result = this.getResultInfo();
|
|
87
|
+
return {
|
|
88
|
+
teamWinner: result.teamWinner,
|
|
89
|
+
teamLoser: result.teamLoser,
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
exports.AmericanFootballResult = AmericanFootballResult;
|
|
94
|
+
//# sourceMappingURL=AmericanFootballResult.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballResult.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballResult.ts"],"names":[],"mappings":";;;AACA,+CAA0G;AAE1G,MAAM,UAAU,GAAG,GAA2B,EAAE;IAC9C,OAAO;QACL,WAAW,EAAE,CAAC;QACd,UAAU,EAAE,CAAC;QACb,WA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SAAS,EAAE,MAAM,CAAC,SAAS;SAC5B,CAAC;IACJ,CAAC;CACF;AAzFD,wDAyFC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballRoster = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
class AmericanFootballRoster extends jl_sprt_core_1.A_TeamRoster {
|
|
6
|
+
}
|
|
7
|
+
exports.AmericanFootballRoster = AmericanFootballRoster;
|
|
8
|
+
//# sourceMappingURL=AmericanFootballRoster.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballRoster.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballRoster.ts"],"names":[],"mappings":";;;AAAA,+CAA4C;AAE5C,MAAa,sBAAuB,SAAQ,2BAAY;CAAG;AAA3D,wDAA2D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballScore.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballScore.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { A_Serie, IAmericanFootballScore, ISerieCreationInfo } from 'jl-sprt-core';
|
|
2
|
+
import { AmericanFootballRoster } from './AmericanFootballRoster';
|
|
3
|
+
import { AmericanFootballTeam } from './AmericanFootballTeam';
|
|
4
|
+
export interface IAmericanFootballSerieCreationInfo extends ISerieCreationInfo<AmericanFootballRoster> {
|
|
5
|
+
}
|
|
6
|
+
/**
|
|
7
|
+
* Serie de American Football.
|
|
8
|
+
*
|
|
9
|
+
* En una serie de ida y vuelta, el ganador es el equipo
|
|
10
|
+
* con mayor cantidad de puntos acumulados entre ambos partidos.
|
|
11
|
+
*
|
|
12
|
+
* Si el resultado acumulado queda empatado al finalizar
|
|
13
|
+
* el segundo partido, AmericanFootballMatchPlay resuelve
|
|
14
|
+
* el empate mediante tiempo extra.
|
|
15
|
+
*/
|
|
16
|
+
export declare class AmericanFootballSerie extends A_Serie<IAmericanFootballScore, AmericanFootballRoster> {
|
|
17
|
+
constructor(info: IAmericanFootballSerieCreationInfo);
|
|
18
|
+
get isFinished(): boolean;
|
|
19
|
+
get winner(): AmericanFootballTeam;
|
|
20
|
+
get loser(): AmericanFootballTeam;
|
|
21
|
+
}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballSerie = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const AmericanFootballMatch_1 = require("./AmericanFootballMatch");
|
|
6
|
+
/**
|
|
7
|
+
* Serie de American Football.
|
|
8
|
+
*
|
|
9
|
+
* En una serie de ida y vuelta, el ganador es el equipo
|
|
10
|
+
* con mayor cantidad de puntos acumulados entre ambos partidos.
|
|
11
|
+
*
|
|
12
|
+
* Si el resultado acumulado queda empatado al finalizar
|
|
13
|
+
* el segundo partido, AmericanFootballMatchPlay resuelve
|
|
14
|
+
* el empate mediante tiempo extra.
|
|
15
|
+
*/
|
|
16
|
+
class AmericanFootballSerie extends jl_sprt_core_1.A_Serie {
|
|
17
|
+
constructor(info) {
|
|
18
|
+
super(info, (mci) => new AmericanFootballMatch_1.AmericanFootballMatch(mci));
|
|
19
|
+
}
|
|
20
|
+
get isFinished() {
|
|
21
|
+
return this._matches.every((m) => m.isFinished);
|
|
22
|
+
}
|
|
23
|
+
get winner() {
|
|
24
|
+
if (!this.isFinished)
|
|
25
|
+
throw new Error('La serie todavía no terminó');
|
|
26
|
+
const results = this.getResults();
|
|
27
|
+
/*
|
|
28
|
+
* Serie de un solo partido.
|
|
29
|
+
*/
|
|
30
|
+
if (results.length === 1) {
|
|
31
|
+
const winnerId = results[0].getWinnerInfo().teamWinner;
|
|
32
|
+
if (winnerId === this.teamOne.id)
|
|
33
|
+
return this.teamOne;
|
|
34
|
+
if (winnerId === this.teamTwo.id)
|
|
35
|
+
return this.teamTwo;
|
|
36
|
+
throw new Error('No hubo ganador en la serie de AmericanFootball');
|
|
37
|
+
}
|
|
38
|
+
/*
|
|
39
|
+
* Actualmente solo soportamos series de ida y vuelta.
|
|
40
|
+
*/
|
|
41
|
+
if (results.length !== 2)
|
|
42
|
+
throw new Error('Unsupported AmericanFootball series');
|
|
43
|
+
let teamOneTotal = 0;
|
|
44
|
+
let teamTwoTotal = 0;
|
|
45
|
+
for (const result of results) {
|
|
46
|
+
teamOneTotal +=
|
|
47
|
+
result.getScore(this.teamOne.id).totalPoints;
|
|
48
|
+
teamTwoTotal +=
|
|
49
|
+
result.getScore(this.teamTwo.id).totalPoints;
|
|
50
|
+
}
|
|
51
|
+
if (teamOneTotal > teamTwoTotal)
|
|
52
|
+
return this.teamOne;
|
|
53
|
+
if (teamTwoTotal > teamOneTotal)
|
|
54
|
+
return this.teamTwo;
|
|
55
|
+
throw new Error('La serie terminó empatada');
|
|
56
|
+
}
|
|
57
|
+
get loser() {
|
|
58
|
+
return this.winner.id === this._teamTwo.id
|
|
59
|
+
? this.teamOne
|
|
60
|
+
: this.teamTwo;
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
exports.AmericanFootballSerie = AmericanFootballSerie;
|
|
64
|
+
//# sourceMappingURL=AmericanFootballSerie.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballSerie.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballSerie.ts"],"names":[],"mappings":";;;AAAA,+CAAsF;AAItF,mEAAmG;AAKnG;;;;;;;;;GASG;AACH,MAAa,qBACX,SAAQ,sBAAuD;IAE/D,YAAY,IAAwC;QAClD,KAAK,CAAC,IAAI,EAAE,CAAC,GAAuC,EAAE,EAAE,CAAC,IAAI,6CAAqB,CAAC,GAAG,CAAC,CAAC,CAAC;IAC3F,CAAC;IAED,IAAI,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O,IAAI,CAAC,OAAO,CAAC;QAEtB,MAAM,IAAI,KAAK,CAAC,2BAA2B,CAAC,CAAC;IAC/C,CAAC;IAED,IAAI,KAAK;QACP,OAAO,IAAI,CAAC,MAAM,CAAC,EAAE,KAAK,IAAI,CAAC,QAAQ,CAAC,EAAE;YACxC,CAAC,CAAC,IAAI,CAAC,OAAO;YACd,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC;IACnB,CAAC;CACF;AAjED,sDAiEC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { A_Team, ITeamCreator } from 'jl-sprt-core';
|
|
2
|
+
import { AmericanFootballRoster } from './AmericanFootballRoster';
|
|
3
|
+
export declare class AmericanFootballTeam extends A_Team<AmericanFootballRoster> {
|
|
4
|
+
constructor(itc: ITeamCreator);
|
|
5
|
+
getTeamMatch(): AmericanFootballRoster;
|
|
6
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballTeam = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const AmericanFootballRoster_1 = require("./AmericanFootballRoster");
|
|
6
|
+
class AmericanFootballTeam extends jl_sprt_core_1.A_Team {
|
|
7
|
+
constructor(itc) {
|
|
8
|
+
super(itc);
|
|
9
|
+
}
|
|
10
|
+
getTeamMatch() {
|
|
11
|
+
return new AmericanFootballRoster_1.AmericanFootballRoster(this.id);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
exports.AmericanFootballTeam = AmericanFootballTeam;
|
|
15
|
+
//# sourceMappingURL=AmericanFootballTeam.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballTeam.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballTeam.ts"],"names":[],"mappings":";;;AAAA,+CAAoD;AACpD,qEAAkE;AAElE,MAAa,oBAAqB,SAAQ,qBAA8B;IACtE,YAAY,GAAiB;QAC3B,KAAK,CAAC,GAAG,CAAC,CAAA;IACZ,CAAC;IAED,YAAY;QACV,OAAO,IAAI,+CAAsB,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;IAC7C,CAAC;CACF;AARD,oDAQC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { A_TeamTableItem, AnyTeamTableItem, IA_TeamTableItemBase, SortFunc } from "jl-sprt-core";
|
|
2
|
+
import { AmericanFootballTeam } from './AmericanFootballTeam';
|
|
3
|
+
export type AmericanFootballMatchResults = 'W' | 'D' | 'L';
|
|
4
|
+
export type AmericanFootballMatchPuntuations = 'pf' | 'pa';
|
|
5
|
+
export type IAmericanFootballTeamTableItem = IA_TeamTableItemBase & {
|
|
6
|
+
W: number;
|
|
7
|
+
D: number;
|
|
8
|
+
L: number;
|
|
9
|
+
pf: number;
|
|
10
|
+
pa: number;
|
|
11
|
+
sp: number;
|
|
12
|
+
};
|
|
13
|
+
export declare class AmericanFootballTeamTableItem extends A_TeamTableItem<AmericanFootballMatchResults, AmericanFootballMatchPuntuations> {
|
|
14
|
+
constructor(t: AmericanFootballTeam, bsId: string);
|
|
15
|
+
get ps(): number;
|
|
16
|
+
getInitialCountOfMathResults(): {
|
|
17
|
+
[k in AmericanFootballMatchResults]: number;
|
|
18
|
+
};
|
|
19
|
+
getInitialCountOfMathPuntuations(): {
|
|
20
|
+
[k in AmericanFootballMatchPuntuations]: number;
|
|
21
|
+
};
|
|
22
|
+
get W(): number;
|
|
23
|
+
get D(): number;
|
|
24
|
+
get L(): number;
|
|
25
|
+
get pf(): number;
|
|
26
|
+
get pa(): number;
|
|
27
|
+
get sp(): number;
|
|
28
|
+
addWM(): void;
|
|
29
|
+
addDM(): void;
|
|
30
|
+
addLM(): void;
|
|
31
|
+
addPf(p: number): void;
|
|
32
|
+
addPa(p: number): void;
|
|
33
|
+
getSortFunc(): SortFunc<AnyTeamTableItem>;
|
|
34
|
+
getInterface(): IAmericanFootballTeamTableItem;
|
|
35
|
+
}
|
|
36
|
+
export declare const AmericanFootballSortFunc: SortFunc<AmericanFootballTeamTableItem>;
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballSortFunc = exports.AmericanFootballTeamTableItem = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
class AmericanFootballTeamTableItem extends jl_sprt_core_1.A_TeamTableItem {
|
|
6
|
+
constructor(t, bsId) {
|
|
7
|
+
super(t, bsId);
|
|
8
|
+
}
|
|
9
|
+
get ps() {
|
|
10
|
+
const { W, D } = this.matchResults;
|
|
11
|
+
return W + 0.5 * D;
|
|
12
|
+
}
|
|
13
|
+
getInitialCountOfMathResults() {
|
|
14
|
+
return { W: 0, D: 0, L: 0 };
|
|
15
|
+
}
|
|
16
|
+
getInitialCountOfMathPuntuations() {
|
|
17
|
+
return { pf: 0, pa: 0 };
|
|
18
|
+
}
|
|
19
|
+
get W() { return this.matchResults.W; }
|
|
20
|
+
get D() { return this.matchResults.D; }
|
|
21
|
+
get L() { return this.matchResults.L; }
|
|
22
|
+
get pf() { return this.matchPuntuations.pf; }
|
|
23
|
+
get pa() { return this.matchPuntuations.pa; }
|
|
24
|
+
get sp() { return this.pf - this.pa; }
|
|
25
|
+
addWM() { this.addMatchResult('W'); }
|
|
26
|
+
addDM() { this.addMatchResult('D'); }
|
|
27
|
+
addLM() { this.addMatchResult('L'); }
|
|
28
|
+
addPf(p) { this.matchPuntuations.pf += p; }
|
|
29
|
+
addPa(p) { this.matchPuntuations.pa += p; }
|
|
30
|
+
getSortFunc() {
|
|
31
|
+
return exports.AmericanFootballSortFunc;
|
|
32
|
+
}
|
|
33
|
+
getInterface() {
|
|
34
|
+
return {
|
|
35
|
+
...super.getInterface(),
|
|
36
|
+
W: this.W,
|
|
37
|
+
D: this.D,
|
|
38
|
+
L: this.L,
|
|
39
|
+
pf: this.pf,
|
|
40
|
+
pa: this.pa,
|
|
41
|
+
sp: this.sp,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
exports.AmericanFootballTeamTableItem = AmericanFootballTeamTableItem;
|
|
46
|
+
const AmericanFootballSortFunc = (a, b, isSE) => {
|
|
47
|
+
if (isSE) {
|
|
48
|
+
if (a.P - b.P !== 0)
|
|
49
|
+
return b.P - a.P;
|
|
50
|
+
}
|
|
51
|
+
if (b.pos - a.pos !== 0)
|
|
52
|
+
return a.pos - b.pos;
|
|
53
|
+
if (!isSE) {
|
|
54
|
+
if (a.pm - b.pm !== 0)
|
|
55
|
+
return b.pm - a.pm;
|
|
56
|
+
}
|
|
57
|
+
if (a.ps - b.ps !== 0)
|
|
58
|
+
return b.ps - a.ps;
|
|
59
|
+
if (a.sp - b.sp !== 0) {
|
|
60
|
+
return b.sp - a.sp;
|
|
61
|
+
}
|
|
62
|
+
return b.pf - a.pf;
|
|
63
|
+
};
|
|
64
|
+
exports.AmericanFootballSortFunc = AmericanFootballSortFunc;
|
|
65
|
+
//# sourceMappingURL=AmericanFootballTeamTableItem.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballTeamTableItem.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballTeamTableItem.ts"],"names":[],"mappings":";;;AACA,+CAAiG;AAejG,MAAa,6BAA8B,SAAQ,8BAA+E;IAEhI,YAAY,CAAuB,EAAE,IAAY;QAC/C,KAAK,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC;IACjB,CAAC;IAED,IAAI,EAAE;QACJ,MAAM,EAAE,CAAC,EAAE,CAAC,EAAE,GAAG,IAAI,CAAC,YAAY,CAAC;QACnC,OAAO,CAAC,GAAG,GAAG,GAAG,CAAC,CAAC;IACrB,CAAC;IAED,4BAA4B;QAC1B,OAAO,EAAE,CAAC,EAAE,CAAC,EAAE,CAAC,E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|
|
3
|
+
export interface IFootballMatchCreationInfo extends IMatchCreationInfo<IFootballScore, FootballRoster> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Partido de fútbol.
|
|
7
|
+
* Extiende A_Match con FootballMatchPlay como simulación.
|
|
8
|
+
* Lógica de advance: 80 min normales, tiempo extra si no se permite empate
|
|
9
|
+
* o si en serie ida/vuelta el resultado global es empate.
|
|
10
|
+
*/
|
|
11
|
+
export declare class FootballMatch extends A_Match<IFootballScore, FootballRoster> {
|
|
12
|
+
constructor(info: IFootballMatchCreationInfo);
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.FootballMatch = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const FootballMatchPlay_1 = require("./FootballMatchPlay");
|
|
6
|
+
const getPlaying = (contextProvider) => {
|
|
7
|
+
return new FootballMatchPlay_1.FootballMatchPlay(contextProvider);
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Partido de fútbol.
|
|
11
|
+
* Extiende A_Match con FootballMatchPlay como simulación.
|
|
12
|
+
* Lógica de advance: 80 min normales, tiempo extra si no se permite empate
|
|
13
|
+
* o si en serie ida/vuelta el resultado global es empate.
|
|
14
|
+
*/
|
|
15
|
+
class FootballMatch extends jl_sprt_core_1.A_Match {
|
|
16
|
+
constructor(info) {
|
|
17
|
+
super(info, getPlaying);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.FootballMatch = FootballMatch;
|
|
21
|
+
//# sourceMappingURL=FootballMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"FootballMatch.js","sourceRoot":"","sources":["../../../src/profiles/football/FootballMatch.ts"],"names":[],"mappings":";;;AACA,+CAAiG;AAIjG,2DAAwD;AAKxD,MAAM,UAAU,GAAG,CAAC,eAAsD,EAAE,EAAE;IAC5E,OAAO,IAAI,qCAAiB,CAAC,eAAe,CAAC,CAAC;AAChD,CAAC,CAAA;AACD;;;;;GAKG;AACH,MAAa,aAAc,SAAQ,sBAAuC;IACxE,YAAY,IAAgC;QAC1C,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACzB,CAAC;CACF;AAJD,sCAIC"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { A_MatchPlay, IFootballScore, MatchContextProvider } from "jl-sprt-core";
|
|
2
|
+
import { FootballRoster } from "./FootballRoster";
|
|
3
|
+
/**
|
|
4
|
+
* Simulación de un partido de fútbol.
|
|
5
|
+
*
|
|
6
|
+
* Tiempo reglamentario:
|
|
7
|
+
* 80 minutos.
|
|
8
|
+
*
|
|
9
|
+
* Si el partido corresponde a una serie y el acumulado queda empatado:
|
|
10
|
+
* - se juegan 20 minutos de tiempo extra;
|
|
11
|
+
* - si continúa el empate, se ejecuta una tanda de penales.
|
|
12
|
+
*
|
|
13
|
+
* Cada advance() representa un intervalo de 5 minutos de juego.
|
|
14
|
+
*
|
|
15
|
+
* El entretiempo consume 3 intervalos de 5 minutos, pero no incrementa
|
|
16
|
+
* el tiempo de juego.
|
|
17
|
+
*/
|
|
18
|
+
export declare class FootballMatchPlay extends A_MatchPlay<IFootballScore, FootballRoster> {
|
|
19
|
+
/** Minuto de juego en que comienza el entretiempo. */
|
|
20
|
+
private static readonly HALFTIME_AT_MINUTE;
|
|
21
|
+
/** Intervalos de descanso del entretiempo. */
|
|
22
|
+
private static readonly HALFTIME_INTERVALS;
|
|
23
|
+
/** Final del tiempo reglamentario. */
|
|
24
|
+
private static readonly REGULAR_TIME;
|
|
25
|
+
/** Final del tiempo extra. */
|
|
26
|
+
private static readonly EXTRA_TIME;
|
|
27
|
+
/** Intervalos de descanso pendientes por consumir. */
|
|
28
|
+
private _breakLeft;
|
|
29
|
+
/** Indica si el entretiempo ya fue realizado. */
|
|
30
|
+
private _halftimeDone;
|
|
31
|
+
/** Indica que se está jugando el tiempo extra. */
|
|
32
|
+
private _extraTime;
|
|
33
|
+
/** Indica que se está ejecutando la tanda de penales. */
|
|
34
|
+
private _penalties;
|
|
35
|
+
/** Cantidad de penales ejecutados por cada equipo. */
|
|
36
|
+
private _penaltiesTaken;
|
|
37
|
+
/** Penales máximos de la primera ronda. */
|
|
38
|
+
private static readonly PENALTIES_PER_INTERVAL;
|
|
39
|
+
private static readonly REGULAR_PENALTY_ROUNDS;
|
|
40
|
+
private _penaltyRound;
|
|
41
|
+
constructor(contextProvider?: MatchContextProvider<IFootballScore>);
|
|
42
|
+
start(one: FootballRoster, two: FootballRoster): void;
|
|
43
|
+
get isFinished(): boolean;
|
|
44
|
+
advance(): void;
|
|
45
|
+
/**
|
|
46
|
+
* Determina si la serie necesita tiempo extra.
|
|
47
|
+
*
|
|
48
|
+
* Para un partido independiente no existe un resultado anterior,
|
|
49
|
+
* por lo que el partido puede terminar empatado.
|
|
50
|
+
*
|
|
51
|
+
* En una serie de ida y vuelta, se compara el acumulado de goles.
|
|
52
|
+
*/
|
|
53
|
+
private mustPlayExtraTime;
|
|
54
|
+
/**
|
|
55
|
+
* Determina si el acumulado de la serie está empatado.
|
|
56
|
+
*
|
|
57
|
+
* Se suma el marcador del partido anterior y el marcador
|
|
58
|
+
* del partido actual.
|
|
59
|
+
*/
|
|
60
|
+
private isAggregateTie;
|
|
61
|
+
/**
|
|
62
|
+
* Genera los goles de un intervalo de juego.
|
|
63
|
+
*/
|
|
64
|
+
private playGoals;
|
|
65
|
+
private playPenalties;
|
|
66
|
+
/**
|
|
67
|
+
* Determina si ya existe ganador en la tanda de penales.
|
|
68
|
+
*/
|
|
69
|
+
private penaltiesHaveWinner;
|
|
70
|
+
}
|