trucoshi 0.2.3 → 0.2.5

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.
Files changed (39) hide show
  1. package/LICENSE +674 -674
  2. package/README.md +60 -60
  3. package/dist/index.d.ts +2 -2
  4. package/dist/index.js +18 -18
  5. package/dist/lib/classes/Deck.d.ts +16 -16
  6. package/dist/lib/classes/Deck.js +38 -38
  7. package/dist/lib/classes/GameLoop.d.ts +22 -20
  8. package/dist/lib/classes/GameLoop.js +64 -61
  9. package/dist/lib/classes/Hand.d.ts +38 -38
  10. package/dist/lib/classes/Hand.js +184 -184
  11. package/dist/lib/classes/Lobby.d.ts +27 -27
  12. package/dist/lib/classes/Lobby.js +113 -112
  13. package/dist/lib/classes/Match.d.ts +18 -18
  14. package/dist/lib/classes/Match.js +81 -72
  15. package/dist/lib/classes/Play.d.ts +21 -21
  16. package/dist/lib/classes/Play.js +39 -39
  17. package/dist/lib/classes/Player.d.ts +29 -27
  18. package/dist/lib/classes/Player.js +74 -69
  19. package/dist/lib/classes/Round.d.ts +17 -17
  20. package/dist/lib/classes/Round.js +33 -33
  21. package/dist/lib/classes/Table.d.ts +12 -12
  22. package/dist/lib/classes/Table.js +30 -30
  23. package/dist/lib/classes/Team.d.ts +19 -19
  24. package/dist/lib/classes/Team.js +48 -48
  25. package/dist/lib/classes/Truco.d.ts +18 -18
  26. package/dist/lib/classes/Truco.js +70 -70
  27. package/dist/lib/classes/index.d.ts +11 -11
  28. package/dist/lib/classes/index.js +27 -27
  29. package/dist/lib/constants.d.ts +45 -45
  30. package/dist/lib/constants.js +84 -84
  31. package/dist/lib/index.d.ts +2 -2
  32. package/dist/lib/index.js +18 -18
  33. package/dist/lib/types.d.ts +50 -50
  34. package/dist/lib/types.js +34 -34
  35. package/dist/lib/utils.d.ts +5 -5
  36. package/dist/lib/utils.js +58 -58
  37. package/dist/types.d.ts +150 -138
  38. package/dist/types.js +97 -65
  39. package/package.json +1 -1
@@ -1,18 +1,18 @@
1
- import { IHand, IHandPoints } from "./Hand";
2
- import { IPlayInstance } from "./Play";
3
- import { ITable } from "./Table";
4
- import { ITeam } from "./Team";
5
- export interface IMatch {
6
- teams: [ITeam, ITeam];
7
- hands: Array<IHand>;
8
- winner: ITeam | null;
9
- currentHand: IHand | null;
10
- table: ITable;
11
- play(): IPlayInstance | null;
12
- addPoints(points: IHandPoints): [ITeam, ITeam];
13
- pushHand(hand: IHand): void;
14
- setCurrentHand(hand: IHand | null): IHand | null;
15
- setWinner(winner: ITeam): void;
16
- getNextTurn(): IteratorResult<IMatch | null, IMatch | null | void>;
17
- }
18
- export declare function Match(table: ITable, teams?: Array<ITeam>, matchPoint?: number): IMatch;
1
+ import { IHand, IHandPoints } from "./Hand";
2
+ import { IPlayInstance } from "./Play";
3
+ import { ITable } from "./Table";
4
+ import { ITeam } from "./Team";
5
+ export interface IMatch {
6
+ teams: [ITeam, ITeam];
7
+ hands: Array<IHand>;
8
+ winner: ITeam | null;
9
+ currentHand: IHand | null;
10
+ table: ITable;
11
+ play(): IPlayInstance | null;
12
+ addPoints(points: IHandPoints): [ITeam, ITeam];
13
+ pushHand(hand: IHand): void;
14
+ setCurrentHand(hand: IHand | null): IHand | null;
15
+ setWinner(winner: ITeam): void;
16
+ getNextTurn(): IteratorResult<IMatch | null, IMatch | null | void>;
17
+ }
18
+ export declare function Match(table: ITable, teams?: Array<ITeam>, matchPoint?: number): IMatch;
@@ -1,72 +1,81 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Match = void 0;
4
- const Deck_1 = require("./Deck");
5
- const Hand_1 = require("./Hand");
6
- function Match(table, teams = [], matchPoint = 9) {
7
- const deck = (0, Deck_1.Deck)().shuffle();
8
- const size = teams[0].players.length;
9
- if (size !== teams[1].players.length) {
10
- throw new Error("Team size mismatch");
11
- }
12
- function* handsGeneratorSequence() {
13
- while (!match.winner) {
14
- deck.shuffle();
15
- const hand = match.setCurrentHand((0, Hand_1.Hand)(match, deck, match.hands.length + 1));
16
- match.pushHand(hand);
17
- while (!hand.finished()) {
18
- const { value } = hand.getNextPlayer();
19
- if (value && value.finished()) {
20
- continue;
21
- }
22
- match.setCurrentHand(value);
23
- yield match;
24
- }
25
- match.setCurrentHand(null);
26
- const teams = match.addPoints(hand.points);
27
- const winner = teams.find((team) => team.points.winner);
28
- if (winner) {
29
- match.setWinner(winner);
30
- match.setCurrentHand(null);
31
- break;
32
- }
33
- match.table.nextTurn();
34
- }
35
- yield match;
36
- }
37
- const handsGenerator = handsGeneratorSequence();
38
- const match = {
39
- winner: null,
40
- teams: teams,
41
- hands: [],
42
- table,
43
- currentHand: null,
44
- play() {
45
- match.getNextTurn();
46
- if (!match.currentHand) {
47
- return null;
48
- }
49
- return match.currentHand.play();
50
- },
51
- addPoints(points) {
52
- match.teams[0].addPoints(matchPoint, points[0]);
53
- match.teams[1].addPoints(matchPoint, points[1]);
54
- return match.teams;
55
- },
56
- pushHand(hand) {
57
- match.hands.push(hand);
58
- },
59
- setCurrentHand(hand) {
60
- match.currentHand = hand;
61
- return match.currentHand;
62
- },
63
- setWinner(winner) {
64
- match.winner = winner;
65
- },
66
- getNextTurn() {
67
- return handsGenerator.next();
68
- },
69
- };
70
- return match;
71
- }
72
- exports.Match = Match;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Match = void 0;
4
+ const Deck_1 = require("./Deck");
5
+ const Hand_1 = require("./Hand");
6
+ const playerIsNotReady = (player) => !player.ready;
7
+ function Match(table, teams = [], matchPoint = 9) {
8
+ const deck = (0, Deck_1.Deck)().shuffle();
9
+ const size = teams[0].players.length;
10
+ if (size !== teams[1].players.length) {
11
+ throw new Error("Team size mismatch");
12
+ }
13
+ function* handsGeneratorSequence() {
14
+ while (!match.winner) {
15
+ if (match.teams[0].players.every(playerIsNotReady)) {
16
+ match.setWinner(match.teams[1]);
17
+ break;
18
+ }
19
+ if (match.teams[1].players.every(playerIsNotReady)) {
20
+ match.setWinner(match.teams[0]);
21
+ break;
22
+ }
23
+ deck.shuffle();
24
+ const hand = match.setCurrentHand((0, Hand_1.Hand)(match, deck, match.hands.length + 1));
25
+ match.pushHand(hand);
26
+ while (!hand.finished()) {
27
+ const { value } = hand.getNextPlayer();
28
+ if (value && value.finished()) {
29
+ continue;
30
+ }
31
+ match.setCurrentHand(value);
32
+ yield match;
33
+ }
34
+ match.setCurrentHand(null);
35
+ const teams = match.addPoints(hand.points);
36
+ const winner = teams.find((team) => team.points.winner);
37
+ if (winner) {
38
+ match.setWinner(winner);
39
+ match.setCurrentHand(null);
40
+ break;
41
+ }
42
+ match.table.nextTurn();
43
+ }
44
+ yield match;
45
+ }
46
+ const handsGenerator = handsGeneratorSequence();
47
+ const match = {
48
+ winner: null,
49
+ teams: teams,
50
+ hands: [],
51
+ table,
52
+ currentHand: null,
53
+ play() {
54
+ match.getNextTurn();
55
+ if (!match.currentHand) {
56
+ return null;
57
+ }
58
+ return match.currentHand.play();
59
+ },
60
+ addPoints(points) {
61
+ match.teams[0].addPoints(matchPoint, points[0]);
62
+ match.teams[1].addPoints(matchPoint, points[1]);
63
+ return match.teams;
64
+ },
65
+ pushHand(hand) {
66
+ match.hands.push(hand);
67
+ },
68
+ setCurrentHand(hand) {
69
+ match.currentHand = hand;
70
+ return match.currentHand;
71
+ },
72
+ setWinner(winner) {
73
+ match.winner = winner;
74
+ },
75
+ getNextTurn() {
76
+ return handsGenerator.next();
77
+ },
78
+ };
79
+ return match;
80
+ }
81
+ exports.Match = Match;
@@ -1,21 +1,21 @@
1
- import { ECommand, EHandState, EnvidoState } from "../../types";
2
- import { ICard } from "./Deck";
3
- import { IHand } from "./Hand";
4
- import { IPlayer } from "./Player";
5
- import { IRound } from "./Round";
6
- import { ITeam } from "./Team";
7
- import { ITruco } from "./Truco";
8
- export interface IPlayInstance {
9
- teams: [ITeam, ITeam];
10
- handIdx: number;
11
- roundIdx: number;
12
- state: EHandState;
13
- truco: ITruco;
14
- envido: EnvidoState;
15
- player: IPlayer | null;
16
- commands: Array<ECommand> | null;
17
- rounds: Array<IRound> | null;
18
- use(idx: number, card: ICard): ICard | null;
19
- say(command: ECommand): ECommand | null;
20
- }
21
- export declare function PlayInstance(hand: IHand, teams: [ITeam, ITeam]): IPlayInstance;
1
+ import { ECommand, EHandState, EnvidoState } from "../../types";
2
+ import { ICard } from "./Deck";
3
+ import { IHand } from "./Hand";
4
+ import { IPlayer } from "./Player";
5
+ import { IRound } from "./Round";
6
+ import { ITeam } from "./Team";
7
+ import { ITruco } from "./Truco";
8
+ export interface IPlayInstance {
9
+ teams: [ITeam, ITeam];
10
+ handIdx: number;
11
+ roundIdx: number;
12
+ state: EHandState;
13
+ truco: ITruco;
14
+ envido: EnvidoState;
15
+ player: IPlayer | null;
16
+ commands: Array<ECommand> | null;
17
+ rounds: Array<IRound> | null;
18
+ use(idx: number, card: ICard): ICard | null;
19
+ say(command: ECommand): ECommand | null;
20
+ }
21
+ export declare function PlayInstance(hand: IHand, teams: [ITeam, ITeam]): IPlayInstance;
@@ -1,39 +1,39 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlayInstance = void 0;
4
- const types_1 = require("../../types");
5
- function PlayInstance(hand, teams) {
6
- var _a, _b, _c;
7
- const instance = {
8
- state: hand.state,
9
- teams,
10
- truco: hand.truco,
11
- envido: hand.envido,
12
- handIdx: hand.idx,
13
- roundIdx: hand.rounds.length,
14
- player: hand.currentPlayer,
15
- commands: [],
16
- rounds: hand.rounds,
17
- use(idx, card) {
18
- return hand.use(idx, card);
19
- },
20
- say(command) {
21
- var _a;
22
- if (!hand._currentPlayer || !((_a = instance.commands) === null || _a === void 0 ? void 0 : _a.includes(command))) {
23
- return null;
24
- }
25
- hand.commands[command](hand._currentPlayer);
26
- return command;
27
- },
28
- };
29
- (_a = instance.commands) === null || _a === void 0 ? void 0 : _a.push(types_1.ESayCommand.MAZO);
30
- (_b = instance.commands) === null || _b === void 0 ? void 0 : _b.push(types_1.ESayCommand.TRUCO);
31
- if (hand.rounds.length === 1) {
32
- (_c = instance.commands) === null || _c === void 0 ? void 0 : _c.push(types_1.EEnvidoCommand.ENVIDO);
33
- }
34
- if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
35
- instance.commands = [types_1.ESayCommand.TRUCO, types_1.ESayCommand.QUIERO, types_1.ESayCommand.NO_QUIERO];
36
- }
37
- return instance;
38
- }
39
- exports.PlayInstance = PlayInstance;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.PlayInstance = void 0;
4
+ const types_1 = require("../../types");
5
+ function PlayInstance(hand, teams) {
6
+ var _a, _b, _c;
7
+ const instance = {
8
+ state: hand.state,
9
+ teams,
10
+ truco: hand.truco,
11
+ envido: hand.envido,
12
+ handIdx: hand.idx,
13
+ roundIdx: hand.rounds.length,
14
+ player: hand.currentPlayer,
15
+ commands: [],
16
+ rounds: hand.rounds,
17
+ use(idx, card) {
18
+ return hand.use(idx, card);
19
+ },
20
+ say(command) {
21
+ var _a;
22
+ if (!hand._currentPlayer || !((_a = instance.commands) === null || _a === void 0 ? void 0 : _a.includes(command))) {
23
+ return null;
24
+ }
25
+ hand.commands[command](hand._currentPlayer);
26
+ return command;
27
+ },
28
+ };
29
+ (_a = instance.commands) === null || _a === void 0 ? void 0 : _a.push(types_1.ESayCommand.MAZO);
30
+ (_b = instance.commands) === null || _b === void 0 ? void 0 : _b.push(types_1.ESayCommand.TRUCO);
31
+ if (hand.rounds.length === 1) {
32
+ (_c = instance.commands) === null || _c === void 0 ? void 0 : _c.push(types_1.EEnvidoCommand.ENVIDO);
33
+ }
34
+ if (hand.state === types_1.EHandState.WAITING_FOR_TRUCO_ANSWER) {
35
+ instance.commands = [types_1.ESayCommand.TRUCO, types_1.ESayCommand.QUIERO, types_1.ESayCommand.NO_QUIERO];
36
+ }
37
+ return instance;
38
+ }
39
+ exports.PlayInstance = PlayInstance;
@@ -1,27 +1,29 @@
1
- import { ECommand } from "../../types";
2
- import { ICard } from "./Deck";
3
- export interface IPlayer {
4
- teamIdx: number;
5
- id: string;
6
- key: string;
7
- session?: string;
8
- hand: Array<ICard>;
9
- commands: Array<ECommand>;
10
- usedHand: Array<ICard>;
11
- prevHand: Array<ICard>;
12
- isTurn: boolean;
13
- isOwner: boolean;
14
- disabled: boolean;
15
- ready: boolean;
16
- setTurn(turn: boolean): void;
17
- getPublicPlayer(): IPublicPlayer;
18
- setSession(session: string): void;
19
- enable(): void;
20
- disable(): void;
21
- setOwner(owner: boolean): void;
22
- setReady(ready: boolean): void;
23
- setHand(hand: Array<ICard>): Array<ICard>;
24
- useCard(idx: number, card: ICard): ICard | null;
25
- }
26
- export type IPublicPlayer = Pick<IPlayer, "id" | "key" | "disabled" | "ready" | "hand" | "usedHand" | "prevHand" | "teamIdx" | "session" | "isTurn" | "isOwner">;
27
- export declare function Player(key: string, id: string, teamIdx: number, isOwner?: boolean): IPlayer;
1
+ import { ECommand } from "../../types";
2
+ import { ICard } from "./Deck";
3
+ export interface IPlayer {
4
+ teamIdx: number;
5
+ id: string;
6
+ key: string;
7
+ session?: string;
8
+ hand: Array<ICard>;
9
+ commands: Array<ECommand>;
10
+ usedHand: Array<ICard>;
11
+ prevHand: Array<ICard>;
12
+ isTurn: boolean;
13
+ isOwner: boolean;
14
+ disabled: boolean;
15
+ ready: boolean;
16
+ connected: boolean;
17
+ setTurn(turn: boolean): void;
18
+ getPublicPlayer(): IPublicPlayer;
19
+ setSession(session: string): void;
20
+ enable(): void;
21
+ disable(): void;
22
+ setConnected(connected: boolean): void;
23
+ setOwner(owner: boolean): void;
24
+ setReady(ready: boolean): void;
25
+ setHand(hand: Array<ICard>): Array<ICard>;
26
+ useCard(idx: number, card: ICard): ICard | null;
27
+ }
28
+ export type IPublicPlayer = Pick<IPlayer, "id" | "key" | "disabled" | "ready" | "connected" | "hand" | "usedHand" | "prevHand" | "teamIdx" | "session" | "isTurn" | "isOwner">;
29
+ export declare function Player(key: string, id: string, teamIdx: number, isOwner?: boolean): IPlayer;
@@ -1,69 +1,74 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Player = void 0;
4
- function Player(key, id, teamIdx, isOwner = false) {
5
- const player = {
6
- key,
7
- id,
8
- session: undefined,
9
- teamIdx,
10
- hand: [],
11
- commands: [],
12
- usedHand: [],
13
- prevHand: [],
14
- isOwner,
15
- isTurn: false,
16
- disabled: false,
17
- ready: false,
18
- setOwner(owner) {
19
- player.isOwner = owner;
20
- },
21
- setTurn(turn) {
22
- player.isTurn = turn;
23
- },
24
- getPublicPlayer() {
25
- const { id, key, disabled, ready, usedHand, prevHand, teamIdx, isTurn, isOwner } = player;
26
- return {
27
- id,
28
- key,
29
- disabled,
30
- ready,
31
- usedHand,
32
- prevHand,
33
- teamIdx,
34
- isTurn,
35
- isOwner,
36
- hand: player.hand.map(() => "xx"),
37
- session: undefined,
38
- };
39
- },
40
- setSession(session) {
41
- player.session = session;
42
- },
43
- enable() {
44
- player.disabled = false;
45
- },
46
- disable() {
47
- player.disabled = true;
48
- },
49
- setReady(ready) {
50
- player.ready = ready;
51
- },
52
- setHand(hand) {
53
- player.prevHand = [...player.usedHand];
54
- player.hand = hand;
55
- player.usedHand = [];
56
- return hand;
57
- },
58
- useCard(idx, card) {
59
- if (player.hand[idx] && player.hand[idx] === card) {
60
- const card = player.hand.splice(idx, 1)[0];
61
- player.usedHand.push(card);
62
- return card;
63
- }
64
- return null;
65
- },
66
- };
67
- return player;
68
- }
69
- exports.Player = Player;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Player = void 0;
4
+ function Player(key, id, teamIdx, isOwner = false) {
5
+ const player = {
6
+ key,
7
+ id,
8
+ session: undefined,
9
+ teamIdx,
10
+ hand: [],
11
+ commands: [],
12
+ usedHand: [],
13
+ prevHand: [],
14
+ isOwner,
15
+ isTurn: false,
16
+ disabled: false,
17
+ connected: false,
18
+ ready: false,
19
+ setOwner(owner) {
20
+ player.isOwner = owner;
21
+ },
22
+ setTurn(turn) {
23
+ player.isTurn = turn;
24
+ },
25
+ getPublicPlayer() {
26
+ const { id, key, connected, disabled, ready, usedHand, prevHand, teamIdx, isTurn, isOwner } = player;
27
+ return {
28
+ id,
29
+ key,
30
+ connected,
31
+ disabled,
32
+ ready,
33
+ usedHand,
34
+ prevHand,
35
+ teamIdx,
36
+ isTurn,
37
+ isOwner,
38
+ hand: player.hand.map(() => "xx"),
39
+ session: undefined,
40
+ };
41
+ },
42
+ setSession(session) {
43
+ player.session = session;
44
+ },
45
+ enable() {
46
+ player.disabled = false;
47
+ },
48
+ disable() {
49
+ player.disabled = true;
50
+ },
51
+ setConnected(connected) {
52
+ player.connected = connected;
53
+ },
54
+ setReady(ready) {
55
+ player.ready = ready;
56
+ },
57
+ setHand(hand) {
58
+ player.prevHand = [...player.usedHand];
59
+ player.hand = hand;
60
+ player.usedHand = [];
61
+ return hand;
62
+ },
63
+ useCard(idx, card) {
64
+ if (player.hand[idx] && player.hand[idx] === card) {
65
+ const card = player.hand.splice(idx, 1)[0];
66
+ player.usedHand.push(card);
67
+ return card;
68
+ }
69
+ return null;
70
+ },
71
+ };
72
+ return player;
73
+ }
74
+ exports.Player = Player;
@@ -1,17 +1,17 @@
1
- import { ICard, IPlayedCard } from "./Deck";
2
- import { IPlayer } from "./Player";
3
- export interface IRound {
4
- tie: boolean;
5
- winner: IPlayer | null;
6
- highest: number;
7
- cards: Array<IPlayedCard>;
8
- turn: number;
9
- nextTurn(): void;
10
- use(playedCard: IPlayedCard): ICard;
11
- }
12
- export interface IRoundPoints {
13
- 0: number;
14
- 1: number;
15
- ties: number;
16
- }
17
- export declare function Round(turn: number): IRound;
1
+ import { ICard, IPlayedCard } from "./Deck";
2
+ import { IPlayer } from "./Player";
3
+ export interface IRound {
4
+ tie: boolean;
5
+ winner: IPlayer | null;
6
+ highest: number;
7
+ cards: Array<IPlayedCard>;
8
+ turn: number;
9
+ nextTurn(): void;
10
+ use(playedCard: IPlayedCard): ICard;
11
+ }
12
+ export interface IRoundPoints {
13
+ 0: number;
14
+ 1: number;
15
+ ties: number;
16
+ }
17
+ export declare function Round(turn: number): IRound;
@@ -1,33 +1,33 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Round = void 0;
4
- const utils_1 = require("../utils");
5
- const Deck_1 = require("./Deck");
6
- function Round(turn) {
7
- const round = {
8
- turn,
9
- highest: -1,
10
- winner: null,
11
- cards: [],
12
- tie: false,
13
- nextTurn() {
14
- round.turn++;
15
- },
16
- use({ card, player }) {
17
- var _a;
18
- const value = (0, utils_1.getCardValue)(card);
19
- if (value === round.highest && player.teamIdx !== ((_a = round.winner) === null || _a === void 0 ? void 0 : _a.teamIdx)) {
20
- round.tie = true;
21
- }
22
- if (value > round.highest) {
23
- round.tie = false;
24
- round.highest = value;
25
- round.winner = player;
26
- }
27
- round.cards.push((0, Deck_1.PlayedCard)(player, card));
28
- return card;
29
- },
30
- };
31
- return round;
32
- }
33
- exports.Round = Round;
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Round = void 0;
4
+ const utils_1 = require("../utils");
5
+ const Deck_1 = require("./Deck");
6
+ function Round(turn) {
7
+ const round = {
8
+ turn,
9
+ highest: -1,
10
+ winner: null,
11
+ cards: [],
12
+ tie: false,
13
+ nextTurn() {
14
+ round.turn++;
15
+ },
16
+ use({ card, player }) {
17
+ var _a;
18
+ const value = (0, utils_1.getCardValue)(card);
19
+ if (value === round.highest && player.teamIdx !== ((_a = round.winner) === null || _a === void 0 ? void 0 : _a.teamIdx)) {
20
+ round.tie = true;
21
+ }
22
+ if (value > round.highest) {
23
+ round.tie = false;
24
+ round.highest = value;
25
+ round.winner = player;
26
+ }
27
+ round.cards.push((0, Deck_1.PlayedCard)(player, card));
28
+ return card;
29
+ },
30
+ };
31
+ return round;
32
+ }
33
+ exports.Round = Round;
@@ -1,12 +1,12 @@
1
- import { IPlayedCard } from "./Deck";
2
- import { IPlayer } from "./Player";
3
- import { ITeam } from "./Team";
4
- export interface ITable {
5
- forehandIdx: number;
6
- cards: Array<Array<IPlayedCard>>;
7
- players: Array<IPlayer>;
8
- nextTurn(): IPlayer;
9
- player(idx?: number): IPlayer;
10
- getPlayerPosition(id: string): number;
11
- }
12
- export declare function Table(players: Array<IPlayer>, teams: Array<ITeam>): ITable;
1
+ import { IPlayedCard } from "./Deck";
2
+ import { IPlayer } from "./Player";
3
+ import { ITeam } from "./Team";
4
+ export interface ITable {
5
+ forehandIdx: number;
6
+ cards: Array<Array<IPlayedCard>>;
7
+ players: Array<IPlayer>;
8
+ nextTurn(): IPlayer;
9
+ player(idx?: number): IPlayer;
10
+ getPlayerPosition(id: string): number;
11
+ }
12
+ export declare function Table(players: Array<IPlayer>, teams: Array<ITeam>): ITable;