@block52/poker-vm-sdk 1.2.16 → 1.2.17

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.
@@ -0,0 +1,65 @@
1
+ import { IJSONModel } from "./deck";
2
+ import { Card, TexasHoldemRound } from "./types/game";
3
+ /**
4
+ * The community board for a Texas Hold'em hand.
5
+ *
6
+ * Encapsulates the two community-card arrays the engine currently keeps — the
7
+ * cards dealt street-by-street (`street`, persisted to the DTO) and the five
8
+ * pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
9
+ * refactor: every accessor returns exactly what the inline engine logic did, so
10
+ * behaviour is unchanged. Collapsing the two arrays into a single canonical
11
+ * board is a separate, consensus-affecting change (issue #2299).
12
+ */
13
+ export declare class Board implements IJSONModel {
14
+ static readonly MAX_COMMUNITY_CARDS = 5;
15
+ private readonly street;
16
+ private readonly preDealt;
17
+ /**
18
+ * Append cards dealt for the current street (was `_communityCards.push`).
19
+ */
20
+ addStreet(cards: Card[]): void;
21
+ /**
22
+ * Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
23
+ */
24
+ setPreDealt(cards: Card[]): void;
25
+ /**
26
+ * Number of street-dealt cards (was `_communityCards.length`).
27
+ */
28
+ get streetLength(): number;
29
+ /**
30
+ * Number of pre-dealt cards (was `_communityCards2.length`).
31
+ */
32
+ get preDealtLength(): number;
33
+ /**
34
+ * The street-dealt community cards (was `[...this._communityCards]`).
35
+ */
36
+ get cards(): Card[];
37
+ /**
38
+ * The community cards visible at a given round, taken from the pre-dealt
39
+ * board — matching the previous `getCommunityCards()` exactly:
40
+ * FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
41
+ */
42
+ forRound(round: TexasHoldemRound): Card[];
43
+ /**
44
+ * The board `findWinners` falls back to when `forRound` is short: the
45
+ * pre-dealt board for live games, else the street board rehydrated from JSON.
46
+ * Preserves the previous inline selection verbatim.
47
+ */
48
+ forEvaluation(count: number): Card[];
49
+ /**
50
+ * The board `calculateWinner` falls back to at an early showdown: the fully
51
+ * dealt street board if available, else the pre-dealt board. Preserves the
52
+ * previous inline selection verbatim.
53
+ */
54
+ forShowdown(): Card[];
55
+ /**
56
+ * Clear both boards for a new hand (was two `.length = 0` assignments).
57
+ */
58
+ clear(): void;
59
+ /**
60
+ * Serialize the street board to mnemonics, matching
61
+ * `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
62
+ */
63
+ toJson(): string[];
64
+ }
65
+ //# sourceMappingURL=board.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"board.d.ts","sourceRoot":"","sources":["../src/board.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,QAAQ,CAAC;AACpC,OAAO,EAAE,IAAI,EAAE,gBAAgB,EAAE,MAAM,cAAc,CAAC;AAEtD;;;;;;;;;GASG;AACH,qBAAa,KAAM,YAAW,UAAU;IACpC,gBAAuB,mBAAmB,KAAK;IAI/C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAc;IAErC,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAc;IAEvC;;OAEG;IACI,SAAS,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIrC;;OAEG;IACI,WAAW,CAAC,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI;IAIvC;;OAEG;IACH,IAAW,YAAY,IAAI,MAAM,CAEhC;IAED;;OAEG;IACH,IAAW,cAAc,IAAI,MAAM,CAElC;IAED;;OAEG;IACH,IAAW,KAAK,IAAI,IAAI,EAAE,CAEzB;IAED;;;;OAIG;IACI,QAAQ,CAAC,KAAK,EAAE,gBAAgB,GAAG,IAAI,EAAE;IAchD;;;;OAIG;IACI,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI,EAAE;IAM3C;;;;OAIG;IACI,WAAW,IAAI,IAAI,EAAE;IAM5B;;OAEG;IACI,KAAK,IAAI,IAAI;IAKpB;;;OAGG;IACI,MAAM,IAAI,MAAM,EAAE;CAG5B"}
package/dist/index.d.ts CHANGED
@@ -46125,6 +46125,69 @@ declare class Deck implements IDeck, IJSONModel {
46125
46125
  private initStandard52;
46126
46126
  }
46127
46127
 
46128
+ /**
46129
+ * The community board for a Texas Hold'em hand.
46130
+ *
46131
+ * Encapsulates the two community-card arrays the engine currently keeps — the
46132
+ * cards dealt street-by-street (`street`, persisted to the DTO) and the five
46133
+ * pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
46134
+ * refactor: every accessor returns exactly what the inline engine logic did, so
46135
+ * behaviour is unchanged. Collapsing the two arrays into a single canonical
46136
+ * board is a separate, consensus-affecting change (issue #2299).
46137
+ */
46138
+ declare class Board implements IJSONModel {
46139
+ static readonly MAX_COMMUNITY_CARDS = 5;
46140
+ private readonly street;
46141
+ private readonly preDealt;
46142
+ /**
46143
+ * Append cards dealt for the current street (was `_communityCards.push`).
46144
+ */
46145
+ addStreet(cards: Card[]): void;
46146
+ /**
46147
+ * Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
46148
+ */
46149
+ setPreDealt(cards: Card[]): void;
46150
+ /**
46151
+ * Number of street-dealt cards (was `_communityCards.length`).
46152
+ */
46153
+ get streetLength(): number;
46154
+ /**
46155
+ * Number of pre-dealt cards (was `_communityCards2.length`).
46156
+ */
46157
+ get preDealtLength(): number;
46158
+ /**
46159
+ * The street-dealt community cards (was `[...this._communityCards]`).
46160
+ */
46161
+ get cards(): Card[];
46162
+ /**
46163
+ * The community cards visible at a given round, taken from the pre-dealt
46164
+ * board — matching the previous `getCommunityCards()` exactly:
46165
+ * FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
46166
+ */
46167
+ forRound(round: TexasHoldemRound): Card[];
46168
+ /**
46169
+ * The board `findWinners` falls back to when `forRound` is short: the
46170
+ * pre-dealt board for live games, else the street board rehydrated from JSON.
46171
+ * Preserves the previous inline selection verbatim.
46172
+ */
46173
+ forEvaluation(count: number): Card[];
46174
+ /**
46175
+ * The board `calculateWinner` falls back to at an early showdown: the fully
46176
+ * dealt street board if available, else the pre-dealt board. Preserves the
46177
+ * previous inline selection verbatim.
46178
+ */
46179
+ forShowdown(): Card[];
46180
+ /**
46181
+ * Clear both boards for a new hand (was two `.length = 0` assignments).
46182
+ */
46183
+ clear(): void;
46184
+ /**
46185
+ * Serialize the street board to mnemonics, matching
46186
+ * `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
46187
+ */
46188
+ toJson(): string[];
46189
+ }
46190
+
46128
46191
  /**
46129
46192
  * Example integration of custom poker solver with game engine
46130
46193
  * Demonstrates how to replace pokersolver with our custom implementation
@@ -46911,5 +46974,5 @@ declare const Client: typeof IgniteClient & Constructor<{
46911
46974
  }>;
46912
46975
  declare const registry: Registry;
46913
46976
 
46914
- export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SIT_IN_METHOD_NEXT_BB, SIT_IN_METHOD_POST_NOW, SIT_OUT_METHOD_NEXT_BB, SIT_OUT_METHOD_NEXT_HAND, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
46977
+ export { AllPlayerActions, BLOCK52_HD_PATH, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SIT_IN_METHOD_NEXT_BB, SIT_IN_METHOD_POST_NOW, SIT_OUT_METHOD_NEXT_BB, SIT_OUT_METHOD_NEXT_HAND, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
46915
46978
  export type { AccountDTO, ActionDTO, Block, BlockDTO, BlockHeader, BlockHeaderDTO, BlockID, BlockResponse, BurnResponseDTO, Card, EquityHand, EquityRequest, EquityResponse, EquityResult, GameListItem, GameOptions, GameOptionsDTO, GameOptionsResponse, GameStateResponse, GameStateResponseDTO, HandEvaluation, ISignedResponse, LegalActionDTO, PayoutPlaceDTO, PerformActionResponse, PlayerDTO, RPCRequest, RPCRequestParams, RPCResponse, RakeConfig, RakeConfigDTO, ResultDTO, SitInMethod, SitOutMethod, TexasHoldemGameState, TexasHoldemStateDTO, TransactionDTO, TransactionResponse, WalletInfo, WinnerDTO, WithdrawResponseDTO };
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAA;AAChD,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAkC/C,QAAA,MAAM,MAAM;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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Deck.SUIT_MAP = {
57317
57317
  [SUIT.SPADES]: "S"
57318
57318
  };
57319
57319
 
57320
+ /**
57321
+ * The community board for a Texas Hold'em hand.
57322
+ *
57323
+ * Encapsulates the two community-card arrays the engine currently keeps — the
57324
+ * cards dealt street-by-street (`street`, persisted to the DTO) and the five
57325
+ * pre-dealt up front at `deal()` (`preDealt`) — behind one type. This is a pure
57326
+ * refactor: every accessor returns exactly what the inline engine logic did, so
57327
+ * behaviour is unchanged. Collapsing the two arrays into a single canonical
57328
+ * board is a separate, consensus-affecting change (issue #2299).
57329
+ */
57330
+ class Board {
57331
+ constructor() {
57332
+ // Dealt one street at a time via dealCommunityCards() (was `_communityCards`).
57333
+ // This is the board persisted to the game DTO and rehydrated from JSON.
57334
+ this.street = [];
57335
+ // All five dealt up front at deal() (was `_communityCards2`).
57336
+ this.preDealt = [];
57337
+ }
57338
+ /**
57339
+ * Append cards dealt for the current street (was `_communityCards.push`).
57340
+ */
57341
+ addStreet(cards) {
57342
+ this.street.push(...cards);
57343
+ }
57344
+ /**
57345
+ * Record the five cards pre-dealt at deal() (was `_communityCards2.push`).
57346
+ */
57347
+ setPreDealt(cards) {
57348
+ this.preDealt.push(...cards);
57349
+ }
57350
+ /**
57351
+ * Number of street-dealt cards (was `_communityCards.length`).
57352
+ */
57353
+ get streetLength() {
57354
+ return this.street.length;
57355
+ }
57356
+ /**
57357
+ * Number of pre-dealt cards (was `_communityCards2.length`).
57358
+ */
57359
+ get preDealtLength() {
57360
+ return this.preDealt.length;
57361
+ }
57362
+ /**
57363
+ * The street-dealt community cards (was `[...this._communityCards]`).
57364
+ */
57365
+ get cards() {
57366
+ return [...this.street];
57367
+ }
57368
+ /**
57369
+ * The community cards visible at a given round, taken from the pre-dealt
57370
+ * board — matching the previous `getCommunityCards()` exactly:
57371
+ * FLOP -> preDealt[0..3], TURN -> preDealt[0..4], RIVER -> preDealt[0..5].
57372
+ */
57373
+ forRound(round) {
57374
+ const cards = [];
57375
+ if (round === TexasHoldemRound.FLOP) {
57376
+ cards.push(...this.preDealt.slice(0, 3));
57377
+ }
57378
+ if (round === TexasHoldemRound.TURN) {
57379
+ cards.push(...this.preDealt.slice(0, 4));
57380
+ }
57381
+ if (round === TexasHoldemRound.RIVER) {
57382
+ cards.push(...this.preDealt.slice(0, 5));
57383
+ }
57384
+ return cards;
57385
+ }
57386
+ /**
57387
+ * The board `findWinners` falls back to when `forRound` is short: the
57388
+ * pre-dealt board for live games, else the street board rehydrated from JSON.
57389
+ * Preserves the previous inline selection verbatim.
57390
+ */
57391
+ forEvaluation(count) {
57392
+ return this.preDealt.length >= count
57393
+ ? this.preDealt.slice(0, count)
57394
+ : this.street.slice(0, count);
57395
+ }
57396
+ /**
57397
+ * The board `calculateWinner` falls back to at an early showdown: the fully
57398
+ * dealt street board if available, else the pre-dealt board. Preserves the
57399
+ * previous inline selection verbatim.
57400
+ */
57401
+ forShowdown() {
57402
+ return this.street.length >= Board.MAX_COMMUNITY_CARDS
57403
+ ? this.street.slice(0, Board.MAX_COMMUNITY_CARDS)
57404
+ : this.preDealt.slice(0, Board.MAX_COMMUNITY_CARDS);
57405
+ }
57406
+ /**
57407
+ * Clear both boards for a new hand (was two `.length = 0` assignments).
57408
+ */
57409
+ clear() {
57410
+ this.street.length = 0;
57411
+ this.preDealt.length = 0;
57412
+ }
57413
+ /**
57414
+ * Serialize the street board to mnemonics, matching
57415
+ * `TexasHoldemStateDTO.communityCards` (was `_communityCards.map(...)`).
57416
+ */
57417
+ toJson() {
57418
+ return this.street.map(card => card.mnemonic);
57419
+ }
57420
+ }
57421
+ Board.MAX_COMMUNITY_CARDS = 5;
57422
+
57320
57423
  /**
57321
57424
  * Example integration of custom poker solver with game engine
57322
57425
  * Demonstrates how to replace pokersolver with our custom implementation
@@ -61861,5 +61964,5 @@ const registry = new Registry([
61861
61964
  ...msgTypes,
61862
61965
  ]);
61863
61966
 
61864
- export { AllPlayerActions, BLOCK52_HD_PATH, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params$c as Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SIT_IN_METHOD_NEXT_BB, SIT_IN_METHOD_POST_NOW, SIT_OUT_METHOD_NEXT_BB, SIT_OUT_METHOD_NEXT_HAND, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
61967
+ export { AllPlayerActions, BLOCK52_HD_PATH, Board, COSMOS_CONSTANTS, Client, CosmosClient, Deck, GameFormat, GameStatus, GameVariant, HandType, KEYS, MissingWalletError, NonPlayerActionType, Params$c as Params, PlayerActionType, PlayerStatus, PokerGameIntegration, PokerSolver, RPCMethods, SIT_IN_METHOD_NEXT_BB, SIT_IN_METHOD_POST_NOW, SIT_OUT_METHOD_NEXT_BB, SIT_OUT_METHOD_NEXT_HAND, SUIT, SigningCosmosClient, TexasHoldemRound, WithdrawalRequest, createSigningClientFromMnemonic, createWalletFromMnemonic, formatGameFormatDisplay, formatGameVariantDisplay, generateWallet, getActionByType, getAddressFromMnemonic, getDefaultCosmosConfig, getGameFormat, getGameFormatForCosmos, getGameFormatFromObject, getGameVariant, hasAction, isCashFormat, isEmptyAddress, isSitAndGoFormat, isTournamentFormat, isValidMnemonic, isValidPlayerAddress, parseGameFormat, parseGameVariant, registry };
61865
61968
  //# sourceMappingURL=index.esm.js.map