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
|
File without changes
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/engines/types.ts"],"names":[],"mappings":""}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export { AmericanFootballProfile } from './profiles/americanFootball/AmericanFootballProfile';
|
|
2
|
+
export { FootballProfile } from './profiles/football/FootballProfile';
|
|
3
|
+
export { VolleyballProfile } from './profiles/volleyball/VolleyballProfile';
|
|
4
|
+
export { AmericanFootballMatch } from './profiles/americanFootball/AmericanFootballMatch';
|
|
5
|
+
export { AmericanFootballMatchPlay } from './profiles/americanFootball/AmericanFootballMatchPlay';
|
|
6
|
+
export { AmericanFootballResult } from './profiles/americanFootball/AmericanFootballResult';
|
|
7
|
+
export { AmericanFootballSerie } from './profiles/americanFootball/AmericanFootballSerie';
|
|
8
|
+
export { AmericanFootballTeamTableItem } from './profiles/americanFootball/AmericanFootballTeamTableItem';
|
|
9
|
+
export { IAmericanFootballScore } from './profiles/americanFootball/AmericanFootballScore';
|
|
10
|
+
export type { AmericanFootballMatchResults, AmericanFootballMatchPuntuations, IAmericanFootballTeamTableItem } from './profiles/americanFootball/AmericanFootballTeamTableItem';
|
|
11
|
+
export { FootballMatch } from './profiles/football/FootballMatch';
|
|
12
|
+
export { FootballMatchPlay } from './profiles/football/FootballMatchPlay';
|
|
13
|
+
export { FootballResult } from './profiles/football/FootballResult';
|
|
14
|
+
export { FootballSerie } from './profiles/football/FootballSerie';
|
|
15
|
+
export { FootballTeamTableItem } from './profiles/football/FootballTeamTableItem';
|
|
16
|
+
export { IFootballScore } from './profiles/football/FootballScore';
|
|
17
|
+
export type { FootballMatchResults, FootballMatchPuntuations, IFootballTeamTableItem } from './profiles/football/FootballTeamTableItem';
|
|
18
|
+
export { VolleyballMatch } from './profiles/volleyball/VolleyballMatch';
|
|
19
|
+
export { VolleyballMatchPlay } from './profiles/volleyball/VolleyballMatchPlay';
|
|
20
|
+
export { VolleyballResult } from './profiles/volleyball/VolleyballResult';
|
|
21
|
+
export { VolleyballSerie } from './profiles/volleyball/VolleyballSerie';
|
|
22
|
+
export { VolleyballTeamTableItem } from './profiles/volleyball/VolleyballTeamTableItem';
|
|
23
|
+
export { IVolleyballScore } from './profiles/volleyball/VolleyballScore';
|
|
24
|
+
export type { VolleyballMatchResults, VolleyballMatchPuntuations, IVolleyballTeamTableItem } from './profiles/volleyball/VolleyballTeamTableItem';
|
|
25
|
+
export { randomFloat, reseedRandom } from './randomSource';
|
|
26
|
+
export { TMatchScore } from './profiles/types';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.reseedRandom = exports.randomFloat = exports.VolleyballTeamTableItem = exports.VolleyballSerie = exports.VolleyballResult = exports.VolleyballMatchPlay = exports.VolleyballMatch = exports.FootballTeamTableItem = exports.FootballSerie = exports.FootballResult = exports.FootballMatchPlay = exports.FootballMatch = exports.AmericanFootballTeamTableItem = exports.AmericanFootballSerie = exports.AmericanFootballResult = exports.AmericanFootballMatchPlay = exports.AmericanFootballMatch = exports.VolleyballProfile = exports.FootballProfile = exports.AmericanFootballProfile = void 0;
|
|
4
|
+
// Profiles and concrete match implementations by sport.
|
|
5
|
+
var AmericanFootballProfile_1 = require("./profiles/americanFootball/AmericanFootballProfile");
|
|
6
|
+
Object.defineProperty(exports, "AmericanFootballProfile", { enumerable: true, get: function () { return AmericanFootballProfile_1.AmericanFootballProfile; } });
|
|
7
|
+
var FootballProfile_1 = require("./profiles/football/FootballProfile");
|
|
8
|
+
Object.defineProperty(exports, "FootballProfile", { enumerable: true, get: function () { return FootballProfile_1.FootballProfile; } });
|
|
9
|
+
var VolleyballProfile_1 = require("./profiles/volleyball/VolleyballProfile");
|
|
10
|
+
Object.defineProperty(exports, "VolleyballProfile", { enumerable: true, get: function () { return VolleyballProfile_1.VolleyballProfile; } });
|
|
11
|
+
var AmericanFootballMatch_1 = require("./profiles/americanFootball/AmericanFootballMatch");
|
|
12
|
+
Object.defineProperty(exports, "AmericanFootballMatch", { enumerable: true, get: function () { return AmericanFootballMatch_1.AmericanFootballMatch; } });
|
|
13
|
+
var AmericanFootballMatchPlay_1 = require("./profiles/americanFootball/AmericanFootballMatchPlay");
|
|
14
|
+
Object.defineProperty(exports, "AmericanFootballMatchPlay", { enumerable: true, get: function () { return AmericanFootballMatchPlay_1.AmericanFootballMatchPlay; } });
|
|
15
|
+
var AmericanFootballResult_1 = require("./profiles/americanFootball/AmericanFootballResult");
|
|
16
|
+
Object.defineProperty(exports, "AmericanFootballResult", { enumerable: true, get: function () { return AmericanFootballResult_1.AmericanFootballResult; } });
|
|
17
|
+
var AmericanFootballSerie_1 = require("./profiles/americanFootball/AmericanFootballSerie");
|
|
18
|
+
Object.defineProperty(exports, "AmericanFootballSerie", { enumerable: true, get: function () { return AmericanFootballSerie_1.AmericanFootballSerie; } });
|
|
19
|
+
var AmericanFootballTeamTableItem_1 = require("./profiles/americanFootball/AmericanFootballTeamTableItem");
|
|
20
|
+
Object.defineProperty(exports, "AmericanFootballTeamTableItem", { enumerable: true, get: function () { return AmericanFootballTeamTableItem_1.AmericanFootballTeamTableItem; } });
|
|
21
|
+
var FootballMatch_1 = require("./profiles/football/FootballMatch");
|
|
22
|
+
Object.defineProperty(exports, "FootballMatch", { enumerable: true, get: function () { return FootballMatch_1.FootballMatch; } });
|
|
23
|
+
var FootballMatchPlay_1 = require("./profiles/football/FootballMatchPlay");
|
|
24
|
+
Object.defineProperty(exports, "FootballMatchPlay", { enumerable: true, get: function () { return FootballMatchPlay_1.FootballMatchPlay; } });
|
|
25
|
+
var FootballResult_1 = require("./profiles/football/FootballResult");
|
|
26
|
+
Object.defineProperty(exports, "FootballResult", { enumerable: true, get: function () { return FootballResult_1.FootballResult; } });
|
|
27
|
+
var FootballSerie_1 = require("./profiles/football/FootballSerie");
|
|
28
|
+
Object.defineProperty(exports, "FootballSerie", { enumerable: true, get: function () { return FootballSerie_1.FootballSerie; } });
|
|
29
|
+
var FootballTeamTableItem_1 = require("./profiles/football/FootballTeamTableItem");
|
|
30
|
+
Object.defineProperty(exports, "FootballTeamTableItem", { enumerable: true, get: function () { return FootballTeamTableItem_1.FootballTeamTableItem; } });
|
|
31
|
+
var VolleyballMatch_1 = require("./profiles/volleyball/VolleyballMatch");
|
|
32
|
+
Object.defineProperty(exports, "VolleyballMatch", { enumerable: true, get: function () { return VolleyballMatch_1.VolleyballMatch; } });
|
|
33
|
+
var VolleyballMatchPlay_1 = require("./profiles/volleyball/VolleyballMatchPlay");
|
|
34
|
+
Object.defineProperty(exports, "VolleyballMatchPlay", { enumerable: true, get: function () { return VolleyballMatchPlay_1.VolleyballMatchPlay; } });
|
|
35
|
+
var VolleyballResult_1 = require("./profiles/volleyball/VolleyballResult");
|
|
36
|
+
Object.defineProperty(exports, "VolleyballResult", { enumerable: true, get: function () { return VolleyballResult_1.VolleyballResult; } });
|
|
37
|
+
var VolleyballSerie_1 = require("./profiles/volleyball/VolleyballSerie");
|
|
38
|
+
Object.defineProperty(exports, "VolleyballSerie", { enumerable: true, get: function () { return VolleyballSerie_1.VolleyballSerie; } });
|
|
39
|
+
var VolleyballTeamTableItem_1 = require("./profiles/volleyball/VolleyballTeamTableItem");
|
|
40
|
+
Object.defineProperty(exports, "VolleyballTeamTableItem", { enumerable: true, get: function () { return VolleyballTeamTableItem_1.VolleyballTeamTableItem; } });
|
|
41
|
+
var randomSource_1 = require("./randomSource");
|
|
42
|
+
Object.defineProperty(exports, "randomFloat", { enumerable: true, get: function () { return randomSource_1.randomFloat; } });
|
|
43
|
+
Object.defineProperty(exports, "reseedRandom", { enumerable: true, get: function () { return randomSource_1.reseedRandom; } });
|
|
44
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,wDAAwD;AACxD,+FAA8F;AAArF,kIAAA,uBAAuB,OAAA;AAChC,uEAAsE;AAA7D,kHAAA,eAAe,OAAA;AACxB,6EAA4E;AAAnE,sHAAA,iBAAiB,OAAA;AAE1B,2FAA0F;AAAjF,8HAAA,qBAAqB,OAAA;AAC9B,mGAAkG;AAAzF,sIAAA,yBAAyB,OAAA;AAClC,6FAA4F;AAAnF,gIAAA,sBAAsB,OAAA;AAC/B,2FAA0F;AAAjF,8HAAA,qBAAqB,OAAA;AAC9B,2GAA0G;AAAjG,8IAAA,6BAA6B,OAAA;AAItC,mEAAkE;AAAzD,8GAAA,aAAa,OAAA;AACtB,2EAA0E;AAAjE,sHAAA,iBAAiB,OAAA;AAC1B,qEAAoE;AAA3D,gHAAA,cAAc,OAAA;AACvB,mEAAkE;AAAzD,8GAAA,aAAa,OAAA;AACtB,mFAAkF;AAAzE,8HAAA,qBAAqB,OAAA;AAI9B,yEAAwE;AAA/D,kHAAA,eAAe,OAAA;AACxB,iFAAgF;AAAvE,0HAAA,mBAAmB,OAAA;AAC5B,2EAA0E;AAAjE,oHAAA,gBAAgB,OAAA;AACzB,yEAAwE;AAA/D,kHAAA,eAAe,OAAA;AACxB,yFAAwF;AAA/E,kIAAA,uBAAuB,OAAA;AAIhC,+CAA2D;AAAlD,2GAAA,WAAW,OAAA;AAAE,4GAAA,YAAY,OAAA"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { A_Match, IAmericanFootballScore, IMatchCreationInfo } from 'jl-sprt-core';
|
|
2
|
+
import { AmericanFootballRoster } from './AmericanFootballRoster';
|
|
3
|
+
export interface IAmericanFootballMatchCreationInfo extends IMatchCreationInfo<IAmericanFootballScore, AmericanFootballRoster> {
|
|
4
|
+
}
|
|
5
|
+
/**
|
|
6
|
+
* Partido de fútbol.
|
|
7
|
+
* Extiende A_Match con AmericanFootballMatchPlay 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 AmericanFootballMatch extends A_Match<IAmericanFootballScore, AmericanFootballRoster> {
|
|
12
|
+
constructor(info: IAmericanFootballMatchCreationInfo);
|
|
13
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballMatch = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const AmericanFootballMatchPlay_1 = require("./AmericanFootballMatchPlay");
|
|
6
|
+
const getPlaying = (contextProvider) => {
|
|
7
|
+
return new AmericanFootballMatchPlay_1.AmericanFootballMatchPlay(contextProvider);
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Partido de fútbol.
|
|
11
|
+
* Extiende A_Match con AmericanFootballMatchPlay 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 AmericanFootballMatch extends jl_sprt_core_1.A_Match {
|
|
16
|
+
constructor(info) {
|
|
17
|
+
super(info, getPlaying);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.AmericanFootballMatch = AmericanFootballMatch;
|
|
21
|
+
//# sourceMappingURL=AmericanFootballMatch.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballMatch.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballMatch.ts"],"names":[],"mappings":";;;AACA,+CAAyG;AAIzG,2EAAwE;AAKxE,MAAM,UAAU,GAAG,CAAC,eAA8D,EAAE,EAAE;IACpF,OAAO,IAAI,qDAAyB,CAAC,eAAe,CAAC,CAAC;AACxD,CAAC,CAAA;AACD;;;;;GAKG;AACH,MAAa,qBAAsB,SAAQ,sBAAuD;IAChG,YAAY,IAAwC;QAClD,KAAK,CAAC,IAAI,EAAE,UAAU,CAAC,CAAA;IACzB,CAAC;CACF;AAJD,sDAIC"}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { A_MatchPlay, IAmericanFootballScore, MatchContextProvider } from "jl-sprt-core";
|
|
2
|
+
import { AmericanFootballRoster } from "./AmericanFootballRoster";
|
|
3
|
+
/**
|
|
4
|
+
* Simulación de un partido de American Football.
|
|
5
|
+
*
|
|
6
|
+
* Tiempo reglamentario:
|
|
7
|
+
* 80 minutos. // corregir
|
|
8
|
+
*
|
|
9
|
+
* Si el partido es independiente, puede terminar empatado. // corregir
|
|
10
|
+
*
|
|
11
|
+
* Si pertenece a una eliminación a partido único:
|
|
12
|
+
* - si termina empatado, se juega tiempo extra;
|
|
13
|
+
* - el tiempo extra continúa hasta que haya ganador.
|
|
14
|
+
*
|
|
15
|
+
* Si pertenece a una serie de ida y vuelta:
|
|
16
|
+
* - el primer partido puede terminar empatado;
|
|
17
|
+
* - en el segundo partido se considera el acumulado de ambos partidos;
|
|
18
|
+
* - si el acumulado queda empatado, se juega tiempo extra;
|
|
19
|
+
* - el tiempo extra continúa hasta desempatar el acumulado.
|
|
20
|
+
*
|
|
21
|
+
* Cada advance() representa un intervalo de 5 minutos de juego.
|
|
22
|
+
*
|
|
23
|
+
* El entretiempo consume 3 intervalos de 5 minutos, pero no incrementa
|
|
24
|
+
* el tiempo de juego.
|
|
25
|
+
*/
|
|
26
|
+
export declare class AmericanFootballMatchPlay extends A_MatchPlay<IAmericanFootballScore, AmericanFootballRoster> {
|
|
27
|
+
/** Minuto de juego en que comienza el entretiempo. */
|
|
28
|
+
private static readonly HALFTIME_AT_MINUTE;
|
|
29
|
+
/** Intervalos de descanso del entretiempo. */
|
|
30
|
+
private static readonly HALFTIME_INTERVALS;
|
|
31
|
+
/** Duración del tiempo reglamentario. */
|
|
32
|
+
private static readonly REGULAR_TIME;
|
|
33
|
+
/** Duración de cada período de tiempo extra. */
|
|
34
|
+
private static readonly EXTRA_TIME_INTERVALS;
|
|
35
|
+
/** Intervalos de descanso pendientes por consumir. */
|
|
36
|
+
private _breakLeft;
|
|
37
|
+
/** Indica si el entretiempo ya fue realizado. */
|
|
38
|
+
private _halftimeDone;
|
|
39
|
+
/** Indica que se está jugando tiempo extra. */
|
|
40
|
+
private _extraTime;
|
|
41
|
+
/** Final del período de tiempo extra actualmente en juego. */
|
|
42
|
+
private _extraTimeEnd;
|
|
43
|
+
constructor(contextProvider?: MatchContextProvider<IAmericanFootballScore>);
|
|
44
|
+
start(one: AmericanFootballRoster, two: AmericanFootballRoster): void;
|
|
45
|
+
get isFinished(): boolean;
|
|
46
|
+
advance(): void;
|
|
47
|
+
/**
|
|
48
|
+
* Determina si este partido necesita producir un ganador.
|
|
49
|
+
*
|
|
50
|
+
* context === undefined:
|
|
51
|
+
* partido independiente → el empate está permitido.
|
|
52
|
+
*
|
|
53
|
+
* totalMatches === 1:
|
|
54
|
+
* eliminación a partido único → debe haber ganador.
|
|
55
|
+
*
|
|
56
|
+
* totalMatches === 2:
|
|
57
|
+
* primer partido → puede empatar.
|
|
58
|
+
* segundo partido → debe desempatar si el acumulado queda igualado.
|
|
59
|
+
*/
|
|
60
|
+
private mustPlayExtraTime;
|
|
61
|
+
/**
|
|
62
|
+
* Determina si el marcador del partido actual está empatado.
|
|
63
|
+
*/
|
|
64
|
+
private isMatchTie;
|
|
65
|
+
/**
|
|
66
|
+
* Determina si el acumulado de la serie está empatado.
|
|
67
|
+
*
|
|
68
|
+
* Solo se utiliza en el segundo partido de una serie
|
|
69
|
+
* de ida y vuelta.
|
|
70
|
+
*/
|
|
71
|
+
private isAggregateTie;
|
|
72
|
+
/**
|
|
73
|
+
* Determina si, en el contexto actual, todavía existe empate.
|
|
74
|
+
*/
|
|
75
|
+
private isTieForCompetition;
|
|
76
|
+
/**
|
|
77
|
+
* Comienza un período de tiempo extra.
|
|
78
|
+
*/
|
|
79
|
+
private startExtraTime;
|
|
80
|
+
/**
|
|
81
|
+
* Genera anotaciones durante un intervalo de 5 minutos.
|
|
82
|
+
*/
|
|
83
|
+
private playScore;
|
|
84
|
+
}
|
|
@@ -0,0 +1,273 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballMatchPlay = void 0;
|
|
4
|
+
const jl_sprt_core_1 = require("jl-sprt-core");
|
|
5
|
+
const randomSource_1 = require("../../randomSource");
|
|
6
|
+
const AmericanFootballResult_1 = require("./AmericanFootballResult");
|
|
7
|
+
/**
|
|
8
|
+
* Simulación de un partido de American Football.
|
|
9
|
+
*
|
|
10
|
+
* Tiempo reglamentario:
|
|
11
|
+
* 80 minutos. // corregir
|
|
12
|
+
*
|
|
13
|
+
* Si el partido es independiente, puede terminar empatado. // corregir
|
|
14
|
+
*
|
|
15
|
+
* Si pertenece a una eliminación a partido único:
|
|
16
|
+
* - si termina empatado, se juega tiempo extra;
|
|
17
|
+
* - el tiempo extra continúa hasta que haya ganador.
|
|
18
|
+
*
|
|
19
|
+
* Si pertenece a una serie de ida y vuelta:
|
|
20
|
+
* - el primer partido puede terminar empatado;
|
|
21
|
+
* - en el segundo partido se considera el acumulado de ambos partidos;
|
|
22
|
+
* - si el acumulado queda empatado, se juega tiempo extra;
|
|
23
|
+
* - el tiempo extra continúa hasta desempatar el acumulado.
|
|
24
|
+
*
|
|
25
|
+
* Cada advance() representa un intervalo de 5 minutos de juego.
|
|
26
|
+
*
|
|
27
|
+
* El entretiempo consume 3 intervalos de 5 minutos, pero no incrementa
|
|
28
|
+
* el tiempo de juego.
|
|
29
|
+
*/
|
|
30
|
+
class AmericanFootballMatchPlay extends jl_sprt_core_1.A_MatchPlay {
|
|
31
|
+
constructor(contextProvider) {
|
|
32
|
+
super(contextProvider);
|
|
33
|
+
/** Intervalos de descanso pendientes por consumir. */
|
|
34
|
+
this._breakLeft = 0;
|
|
35
|
+
/** Indica si el entretiempo ya fue realizado. */
|
|
36
|
+
this._halftimeDone = false;
|
|
37
|
+
/** Indica que se está jugando tiempo extra. */
|
|
38
|
+
this._extraTime = false;
|
|
39
|
+
/** Final del período de tiempo extra actualmente en juego. */
|
|
40
|
+
this._extraTimeEnd = AmericanFootballMatchPlay.REGULAR_TIME;
|
|
41
|
+
}
|
|
42
|
+
start(one, two) {
|
|
43
|
+
this._time = 0;
|
|
44
|
+
this._teamOne = one;
|
|
45
|
+
this._teamTwo = two;
|
|
46
|
+
this._result = new AmericanFootballResult_1.AmericanFootballResult(one.id, two.id);
|
|
47
|
+
this._breakLeft = 0;
|
|
48
|
+
this._halftimeDone = false;
|
|
49
|
+
this._extraTime = false;
|
|
50
|
+
this._extraTimeEnd = AmericanFootballMatchPlay.REGULAR_TIME;
|
|
51
|
+
}
|
|
52
|
+
get isFinished() {
|
|
53
|
+
if (!this._result || !this._teamOne || !this._teamTwo)
|
|
54
|
+
return false;
|
|
55
|
+
/*
|
|
56
|
+
* Antes del final del tiempo reglamentario,
|
|
57
|
+
* el partido todavía está en juego.
|
|
58
|
+
*/
|
|
59
|
+
if (!this._extraTime) {
|
|
60
|
+
if (this._time < AmericanFootballMatchPlay.REGULAR_TIME)
|
|
61
|
+
return false;
|
|
62
|
+
/*
|
|
63
|
+
* Partido independiente:
|
|
64
|
+
* el empate está permitido.
|
|
65
|
+
*/
|
|
66
|
+
if (!this.mustPlayExtraTime())
|
|
67
|
+
return true;
|
|
68
|
+
return false;
|
|
69
|
+
}
|
|
70
|
+
/*
|
|
71
|
+
* En tiempo extra, el partido termina apenas
|
|
72
|
+
* deja de existir empate según el contexto competitivo.
|
|
73
|
+
*/
|
|
74
|
+
return !this.isTieForCompetition();
|
|
75
|
+
}
|
|
76
|
+
advance() {
|
|
77
|
+
if (!this._result || !this._teamOne || !this._teamTwo)
|
|
78
|
+
throw new Error("No se inició el match");
|
|
79
|
+
if (this.isFinished)
|
|
80
|
+
return;
|
|
81
|
+
/*
|
|
82
|
+
* Durante el entretiempo no avanza el tiempo de juego.
|
|
83
|
+
*/
|
|
84
|
+
if (this._breakLeft > 0) {
|
|
85
|
+
this._breakLeft--;
|
|
86
|
+
return;
|
|
87
|
+
}
|
|
88
|
+
/*
|
|
89
|
+
* Comienza el entretiempo.
|
|
90
|
+
*/
|
|
91
|
+
if (!this._extraTime && !this._halftimeDone && this._time >= AmericanFootballMatchPlay.HALFTIME_AT_MINUTE) {
|
|
92
|
+
this._halftimeDone = true;
|
|
93
|
+
this._breakLeft =
|
|
94
|
+
AmericanFootballMatchPlay.HALFTIME_INTERVALS - 1;
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
/*
|
|
98
|
+
* Si terminó el tiempo reglamentario, decidir si
|
|
99
|
+
* el partido necesita tiempo extra.
|
|
100
|
+
*/
|
|
101
|
+
if (!this._extraTime && this._time >= AmericanFootballMatchPlay.REGULAR_TIME) {
|
|
102
|
+
if (!this.mustPlayExtraTime())
|
|
103
|
+
return;
|
|
104
|
+
this.startExtraTime();
|
|
105
|
+
}
|
|
106
|
+
/*
|
|
107
|
+
* Avanza 5 minutos de juego.
|
|
108
|
+
*/
|
|
109
|
+
this._time += 5;
|
|
110
|
+
this.playScore();
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Determina si este partido necesita producir un ganador.
|
|
114
|
+
*
|
|
115
|
+
* context === undefined:
|
|
116
|
+
* partido independiente → el empate está permitido.
|
|
117
|
+
*
|
|
118
|
+
* totalMatches === 1:
|
|
119
|
+
* eliminación a partido único → debe haber ganador.
|
|
120
|
+
*
|
|
121
|
+
* totalMatches === 2:
|
|
122
|
+
* primer partido → puede empatar.
|
|
123
|
+
* segundo partido → debe desempatar si el acumulado queda igualado.
|
|
124
|
+
*/
|
|
125
|
+
mustPlayExtraTime() {
|
|
126
|
+
const context = this.context;
|
|
127
|
+
/*
|
|
128
|
+
* Partido independiente.
|
|
129
|
+
*/
|
|
130
|
+
if (!context)
|
|
131
|
+
return false;
|
|
132
|
+
/*
|
|
133
|
+
* Eliminación a partido único.
|
|
134
|
+
*/
|
|
135
|
+
if (context.totalMatches === 1)
|
|
136
|
+
return this.isMatchTie();
|
|
137
|
+
/*
|
|
138
|
+
* Ida y vuelta.
|
|
139
|
+
*/
|
|
140
|
+
if (context.totalMatches === 2) {
|
|
141
|
+
/*
|
|
142
|
+
* Primer partido.
|
|
143
|
+
*/
|
|
144
|
+
if (context.results.length === 0)
|
|
145
|
+
return false;
|
|
146
|
+
/*
|
|
147
|
+
* Segundo partido.
|
|
148
|
+
*/
|
|
149
|
+
if (context.results.length !== 1)
|
|
150
|
+
throw new Error("Unsupported series context");
|
|
151
|
+
return this.isAggregateTie();
|
|
152
|
+
}
|
|
153
|
+
throw new Error("Unsupported series context");
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* Determina si el marcador del partido actual está empatado.
|
|
157
|
+
*/
|
|
158
|
+
isMatchTie() {
|
|
159
|
+
const result = this._result;
|
|
160
|
+
const one = result.getScore(this._teamOne.id);
|
|
161
|
+
const two = result.getScore(this._teamTwo.id);
|
|
162
|
+
return one.totalPoints === two.totalPoints;
|
|
163
|
+
}
|
|
164
|
+
/**
|
|
165
|
+
* Determina si el acumulado de la serie está empatado.
|
|
166
|
+
*
|
|
167
|
+
* Solo se utiliza en el segundo partido de una serie
|
|
168
|
+
* de ida y vuelta.
|
|
169
|
+
*/
|
|
170
|
+
isAggregateTie() {
|
|
171
|
+
const context = this.context;
|
|
172
|
+
if (!context || context.results.length === 0)
|
|
173
|
+
return false;
|
|
174
|
+
if (context.results.length !== 1)
|
|
175
|
+
throw new Error("Unsupported series context");
|
|
176
|
+
const previousResult = context.results[0];
|
|
177
|
+
const previousOne = previousResult.getScore(this._teamOne.id);
|
|
178
|
+
const previousTwo = previousResult.getScore(this._teamTwo.id);
|
|
179
|
+
const currentResult = this._result;
|
|
180
|
+
const currentOne = currentResult.getScore(this._teamOne.id);
|
|
181
|
+
const currentTwo = currentResult.getScore(this._teamTwo.id);
|
|
182
|
+
const totalOne = previousOne.totalPoints +
|
|
183
|
+
currentOne.totalPoints;
|
|
184
|
+
const totalTwo = previousTwo.totalPoints +
|
|
185
|
+
currentTwo.totalPoints;
|
|
186
|
+
return totalOne === totalTwo;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Determina si, en el contexto actual, todavía existe empate.
|
|
190
|
+
*/
|
|
191
|
+
isTieForCompetition() {
|
|
192
|
+
const context = this.context;
|
|
193
|
+
/*
|
|
194
|
+
* Partido independiente.
|
|
195
|
+
* Si llegó a overtime es porque debe producir ganador.
|
|
196
|
+
* Por tanto se compara el marcador del partido.
|
|
197
|
+
*/
|
|
198
|
+
if (!context)
|
|
199
|
+
return this.isMatchTie();
|
|
200
|
+
/*
|
|
201
|
+
* Eliminación a partido único.
|
|
202
|
+
*/
|
|
203
|
+
if (context.totalMatches === 1)
|
|
204
|
+
return this.isMatchTie();
|
|
205
|
+
/*
|
|
206
|
+
* Ida y vuelta.
|
|
207
|
+
*/
|
|
208
|
+
if (context.totalMatches === 2) {
|
|
209
|
+
if (context.results.length !== 1)
|
|
210
|
+
throw new Error("Unsupported series context");
|
|
211
|
+
return this.isAggregateTie();
|
|
212
|
+
}
|
|
213
|
+
throw new Error("Unsupported series context");
|
|
214
|
+
}
|
|
215
|
+
/**
|
|
216
|
+
* Comienza un período de tiempo extra.
|
|
217
|
+
*/
|
|
218
|
+
startExtraTime() {
|
|
219
|
+
this._extraTime = true;
|
|
220
|
+
this._extraTimeEnd =
|
|
221
|
+
this._time +
|
|
222
|
+
AmericanFootballMatchPlay.EXTRA_TIME_INTERVALS;
|
|
223
|
+
}
|
|
224
|
+
/**
|
|
225
|
+
* Genera anotaciones durante un intervalo de 5 minutos.
|
|
226
|
+
*/
|
|
227
|
+
playScore() {
|
|
228
|
+
const result = this._result;
|
|
229
|
+
/*
|
|
230
|
+
* Touchdown + conversión de un punto.
|
|
231
|
+
*/
|
|
232
|
+
if ((0, randomSource_1.randomFloat)() < 0.10) {
|
|
233
|
+
result.addScore(this._teamOne.id, "touchdown");
|
|
234
|
+
result.addScore(this._teamOne.id, "extraPoint");
|
|
235
|
+
}
|
|
236
|
+
if ((0, randomSource_1.randomFloat)() < 0.08) {
|
|
237
|
+
result.addScore(this._teamTwo.id, "touchdown");
|
|
238
|
+
result.addScore(this._teamTwo.id, "extraPoint");
|
|
239
|
+
}
|
|
240
|
+
/*
|
|
241
|
+
* Field goals.
|
|
242
|
+
*/
|
|
243
|
+
if ((0, randomSource_1.randomFloat)() < 0.04) {
|
|
244
|
+
result.addScore(this._teamOne.id, "fieldGoal");
|
|
245
|
+
}
|
|
246
|
+
if ((0, randomSource_1.randomFloat)() < 0.03) {
|
|
247
|
+
result.addScore(this._teamTwo.id, "fieldGoal");
|
|
248
|
+
}
|
|
249
|
+
/*
|
|
250
|
+
* Si estamos en tiempo extra y terminó el período,
|
|
251
|
+
* verificar si todavía existe empate.
|
|
252
|
+
*/
|
|
253
|
+
if (this._extraTime &&
|
|
254
|
+
this._time >= this._extraTimeEnd &&
|
|
255
|
+
this.isTieForCompetition()) {
|
|
256
|
+
/*
|
|
257
|
+
* Se juega otro período de overtime.
|
|
258
|
+
*/
|
|
259
|
+
this._extraTimeEnd +=
|
|
260
|
+
AmericanFootballMatchPlay.EXTRA_TIME_INTERVALS;
|
|
261
|
+
}
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
exports.AmericanFootballMatchPlay = AmericanFootballMatchPlay;
|
|
265
|
+
/** Minuto de juego en que comienza el entretiempo. */
|
|
266
|
+
AmericanFootballMatchPlay.HALFTIME_AT_MINUTE = 40;
|
|
267
|
+
/** Intervalos de descanso del entretiempo. */
|
|
268
|
+
AmericanFootballMatchPlay.HALFTIME_INTERVALS = 3;
|
|
269
|
+
/** Duración del tiempo reglamentario. */
|
|
270
|
+
AmericanFootballMatchPlay.REGULAR_TIME = 80;
|
|
271
|
+
/** Duración de cada período de tiempo extra. */
|
|
272
|
+
AmericanFootballMatchPlay.EXTRA_TIME_INTERVALS = 20;
|
|
273
|
+
//# sourceMappingURL=AmericanFootballMatchPlay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballMatchPlay.js","sourceRoot":"","sources":["../../../src/profiles/american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GAAG,CAAC,AAAJ,CAAK;AAE/C,yCAAyC;AACjB,sCAAY,GAAG,EAAE,AAAL,CAAM;AAE1C,gDAAgD;AACxB,8CAAoB,GAAG,EAAE,AAAL,CAAM"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { IResultInfo, ISportProfile, IMatchCreationInfo, ISerieCreationInfo, IAmericanFootballScore } from "jl-sprt-core";
|
|
2
|
+
import { AmericanFootballTeam } from './AmericanFootballTeam';
|
|
3
|
+
import { AmericanFootballRoster } from './AmericanFootballRoster';
|
|
4
|
+
import { AmericanFootballResult } from "./AmericanFootballResult";
|
|
5
|
+
import { AmericanFootballMatch } from "./AmericanFootballMatch";
|
|
6
|
+
import { AmericanFootballSerie } from "./AmericanFootballSerie";
|
|
7
|
+
import { AmericanFootballTeamTableItem, AmericanFootballMatchResults, AmericanFootballMatchPuntuations } from "./AmericanFootballTeamTableItem";
|
|
8
|
+
/**
|
|
9
|
+
* Profile para fútbol.
|
|
10
|
+
* Score: number (goles)
|
|
11
|
+
* Resultados: W (win), D (draw), L (loss)
|
|
12
|
+
* Puntuaciones: gf (goles a favor), ga (goles en contra)
|
|
13
|
+
*/
|
|
14
|
+
export declare class AmericanFootballProfile implements ISportProfile<IAmericanFootballScore, AmericanFootballMatchResults, AmericanFootballMatchPuntuations, AmericanFootballRoster> {
|
|
15
|
+
createMatch(info: IMatchCreationInfo<IAmericanFootballScore, AmericanFootballRoster>): AmericanFootballMatch;
|
|
16
|
+
createSerie(info: ISerieCreationInfo<AmericanFootballRoster>): AmericanFootballSerie;
|
|
17
|
+
createResult(teamOneId: string, teamTwoId: string): AmericanFootballResult;
|
|
18
|
+
createTableItem(team: AmericanFootballTeam, bsId: string): AmericanFootballTeamTableItem;
|
|
19
|
+
updateTableFromResult(tti: AmericanFootballTeamTableItem, resultInfo: IResultInfo<IAmericanFootballScore>): void;
|
|
20
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AmericanFootballProfile = void 0;
|
|
4
|
+
const AmericanFootballResult_1 = require("./AmericanFootballResult");
|
|
5
|
+
const AmericanFootballMatch_1 = require("./AmericanFootballMatch");
|
|
6
|
+
const AmericanFootballSerie_1 = require("./AmericanFootballSerie");
|
|
7
|
+
const AmericanFootballTeamTableItem_1 = require("./AmericanFootballTeamTableItem");
|
|
8
|
+
/**
|
|
9
|
+
* Profile para fútbol.
|
|
10
|
+
* Score: number (goles)
|
|
11
|
+
* Resultados: W (win), D (draw), L (loss)
|
|
12
|
+
* Puntuaciones: gf (goles a favor), ga (goles en contra)
|
|
13
|
+
*/
|
|
14
|
+
class AmericanFootballProfile {
|
|
15
|
+
createMatch(info) {
|
|
16
|
+
return new AmericanFootballMatch_1.AmericanFootballMatch(info);
|
|
17
|
+
}
|
|
18
|
+
createSerie(info) {
|
|
19
|
+
return new AmericanFootballSerie_1.AmericanFootballSerie(info);
|
|
20
|
+
}
|
|
21
|
+
createResult(teamOneId, teamTwoId) {
|
|
22
|
+
return new AmericanFootballResult_1.AmericanFootballResult(teamOneId, teamTwoId);
|
|
23
|
+
}
|
|
24
|
+
createTableItem(team, bsId) {
|
|
25
|
+
return new AmericanFootballTeamTableItem_1.AmericanFootballTeamTableItem(team, bsId);
|
|
26
|
+
}
|
|
27
|
+
updateTableFromResult(tti, resultInfo) {
|
|
28
|
+
const tid = tti.team.id;
|
|
29
|
+
const isHome = resultInfo.teamOneScore.team === tid;
|
|
30
|
+
const myScore = isHome
|
|
31
|
+
? resultInfo.teamOneScore.score
|
|
32
|
+
: resultInfo.teamTwoScore.score;
|
|
33
|
+
const theirScore = isHome
|
|
34
|
+
? resultInfo.teamTwoScore.score
|
|
35
|
+
: resultInfo.teamOneScore.score;
|
|
36
|
+
tti.addPf(myScore.totalPoints);
|
|
37
|
+
tti.addPa(theirScore.totalPoints);
|
|
38
|
+
if (resultInfo.teamWinner === tid) {
|
|
39
|
+
tti.addWM();
|
|
40
|
+
}
|
|
41
|
+
else if (resultInfo.teamLoser === tid) {
|
|
42
|
+
tti.addLM();
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
tti.addDM();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
exports.AmericanFootballProfile = AmericanFootballProfile;
|
|
50
|
+
//# sourceMappingURL=AmericanFootballProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AmericanFootballProfile.js","sourceRoot":"","sources":["../../../src/profiles/americanFootball/AmericanFootballProfile.ts"],"names":[],"mappings":";;;AAIA,qEAAkE;AAElE,mEAAgE;AAChE,mEAAgE;AAChE,mFAAgJ;AAEhJ;;;;;GAKG;AACH,MAAa,uBAAuB;IAElC,WAAW,CAAC,IAAwE;QAClF,OAAO,IAAI,6CAAqB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,WAAW,CAAC,IAAgD;QAC1D,OAAO,IAAI,6CAAqB,CAAC,IAAI,CAAC,CAAC;IACzC,CAAC;IAED,YAAY,CAAC,SAAiB,EAAE,SAAiB;QAC/C,OAAO,IAAI,+CAAsB,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;IAED,eAAe,CAAC,IAA0B,EAAE,IAAY;QACtD,OAAO,IAAI,6DAA6B,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,qBAAqB,CAAC,GAAkC,EAAE,UAA+C;QACvG,MAAM,GAAG,GAAG,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;QACxB,MAAM,MAAM,GAAG,UAAU,CAAC,YAAY,CAAC,IAAI,KAAK,GAAG,CAAC;QACpD,MAAM,OAAO,GAAG,MAAM;YACpB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK;YAC/B,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC;QAClC,MAAM,UAAU,GAAG,MAAM;YACvB,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK;YAC/B,CAAC,CAAC,UAAU,CAAC,YAAY,CAAC,KAAK,CAAC;QAElC,GAAG,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC;QAC/B,GAAG,CAAC,KAAK,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC;QAElC,IAAI,UAAU,CAAC,UAAU,KAAK,GAAG,EAAE,CAAC;YAClC,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;aAAM,IAAI,UAAU,CAAC,SAAS,KAAK,GAAG,EAAE,CAAC;YACxC,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;aAAM,CAAC;YACN,GAAG,CAAC,KAAK,EAAE,CAAC;QACd,CAAC;IACH,CAAC;CACF;AAvCD,0DAuCC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { A_Result, IResultInfo, IAmericanFootballScore, IWinnerInfo } from 'jl-sprt-core';
|
|
2
|
+
type AmericanFootballScoreUpdate = 'touchdown' | 'extraPoint' | 'twoPointConversion' | 'fieldGoal' | 'safety';
|
|
3
|
+
/**
|
|
4
|
+
* Resultado de un partido de fútbol.
|
|
5
|
+
* Score: number (goles). El ganador es quien tiene mayor cantidad de goles.
|
|
6
|
+
*/
|
|
7
|
+
export declare class AmericanFootballResult extends A_Result<IAmericanFootballScore> {
|
|
8
|
+
constructor(one: string, two: string);
|
|
9
|
+
addScore(id: string, update: AmericanFootballScoreUpdate): void;
|
|
10
|
+
getScore(id: string): IAmericanFootballScore;
|
|
11
|
+
getResultInfo(): IResultInfo<IAmericanFootballScore>;
|
|
12
|
+
getWinnerInfo(): IWinnerInfo;
|
|
13
|
+
}
|
|
14
|
+
export {};
|