@block52/poker-vm-sdk 1.12.0 → 1.12.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/index.d.ts +42 -2
- package/dist/index.esm.js +110 -12
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +110 -12
- package/dist/index.js.map +1 -1
- package/dist/pokerGameIntegration.d.ts +38 -2
- package/dist/pokerGameIntegration.d.ts.map +1 -1
- package/dist/pokerSolver.d.ts +5 -1
- package/dist/pokerSolver.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { HandEvaluation } from "./pokerSolver";
|
|
2
|
-
import { Card } from "./types/game";
|
|
2
|
+
import { Card, WinnerDTO } from "./types/game";
|
|
3
3
|
/**
|
|
4
4
|
* Example integration of custom poker solver with game engine
|
|
5
5
|
* Demonstrates how to replace pokersolver with our custom implementation
|
|
@@ -31,11 +31,47 @@ export declare class PokerGameIntegration {
|
|
|
31
31
|
hand2Evaluation: HandEvaluation;
|
|
32
32
|
};
|
|
33
33
|
/**
|
|
34
|
-
*
|
|
34
|
+
* The winning hand in words, from the winner's best five cards
|
|
35
|
+
* (WinnerDTO.cards) and the board (communityCards): "Full House, Eights
|
|
36
|
+
* over Sevens", "Diamond Flush, Six high", "Set of Sevens". The board tells
|
|
37
|
+
* a set (pocket pair plus one on the board) from trips (one hole card plus a
|
|
38
|
+
* board pair, or all three on the board), which the five cards alone can't.
|
|
39
|
+
* @param cards The winner's five card mnemonics ("6D")
|
|
40
|
+
* @param board The community cards
|
|
41
|
+
* @returns The hand in words, or "" for an uncontested pot (no cards)
|
|
42
|
+
*/
|
|
43
|
+
static describeWinningHand(cards: string[] | undefined, board: string[]): string;
|
|
44
|
+
/**
|
|
45
|
+
* Fill in each winner's name and description from its cards and the board.
|
|
46
|
+
* The engine no longer writes the hand's wording into chain state
|
|
47
|
+
* (poker-vm#2721), so callers run game state through this as it arrives and
|
|
48
|
+
* keep reading winner.name / winner.description as before.
|
|
49
|
+
*
|
|
50
|
+
* A winner with five cards gets "Full House, Eights over Sevens" in both
|
|
51
|
+
* fields. A winner without five cards (an uncontested pot, or an older state
|
|
52
|
+
* that recorded hole cards) is returned unchanged.
|
|
53
|
+
*
|
|
54
|
+
* Returns a new state object; the input is not modified.
|
|
55
|
+
* @param state Any game state with winners and community cards
|
|
56
|
+
*/
|
|
57
|
+
static withWinnerDescriptions<T extends {
|
|
58
|
+
winners: WinnerDTO[];
|
|
59
|
+
communityCards: string[];
|
|
60
|
+
}>(state: T): T;
|
|
61
|
+
/**
|
|
62
|
+
* The hand description in words: "Full House, Eights over Sevens", "Quad
|
|
63
|
+
* Fours", "Diamond Flush, Six high", "Ace high". A flush names its suit from
|
|
64
|
+
* the best hand. The rank and suit words mirror @block52/deck's rankName /
|
|
65
|
+
* suitName.
|
|
35
66
|
* @param evaluation Hand evaluation result
|
|
36
67
|
* @returns Human-readable hand description
|
|
37
68
|
*/
|
|
38
69
|
static formatHandDescription(evaluation: HandEvaluation): string;
|
|
70
|
+
private static readonly RANK_WORDS;
|
|
71
|
+
/** A high-ace rank spelled out ("Ace", "Ten"); plural gives "Aces", "Sixes". */
|
|
72
|
+
private static rankWord;
|
|
73
|
+
/** The suit word every card of a flush shares ("Diamond"), or "" when the hand is empty or mixed. */
|
|
74
|
+
private static flushSuitWord;
|
|
39
75
|
/**
|
|
40
76
|
* Example usage with string cards (for testing/debugging)
|
|
41
77
|
* @param playerCardStrings Array of player hands as mnemonic strings
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pokerGameIntegration.d.ts","sourceRoot":"","sources":["../src/pokerGameIntegration.ts"],"names":[],"mappings":"AAAA,OAAO,EAAe,cAAc,EAAY,MAAM,eAAe,CAAC;AACtE,OAAO,EAAE,IAAI,EAAE,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"pokerGameIntegration.d.ts","sourceRoot":"","sources":["../src/pokerGameIntegration.ts"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AE,EAAE,GAAG;QAC1D,OAAO,EAAE,MAAM,EAAE,CAAC;QAClB,OAAO,EAAE,KAAK,CAAC;YACX,QAAQ,EAAE,MAAM,CAAC;YACjB,eAAe,EAAE,MAAM,CAAC;YACxB,QAAQ,EAAE,OAAO,CAAC;YAClB,QAAQ,EAAE,MAAM,EAAE,CAAC;SACtB,CAAC,CAAC;KACN;CAiBJ"}
|
package/dist/pokerSolver.d.ts
CHANGED
|
@@ -39,7 +39,11 @@ export declare class PokerSolver {
|
|
|
39
39
|
/**
|
|
40
40
|
* Evaluate a 5-card poker hand
|
|
41
41
|
*/
|
|
42
|
-
|
|
42
|
+
/**
|
|
43
|
+
* Evaluate exactly 5 cards (a winner's best hand, WinnerDTO.cards). Use
|
|
44
|
+
* findBestHand for 7.
|
|
45
|
+
*/
|
|
46
|
+
static evaluateHand(cards: Card[]): HandEvaluation;
|
|
43
47
|
/**
|
|
44
48
|
* Check if cards form a straight (excluding low straight A-2-3-4-5)
|
|
45
49
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pokerSolver.d.ts","sourceRoot":"","sources":["../src/pokerSolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,WAAW,EAAQ,MAAM,cAAc,CAAC;AAGvD;;GAEG;AACH,oBAAY,QAAQ;IAChB,SAAS,IAAI;IACb,IAAI,IAAI;IACR,QAAQ,IAAI;IACZ,eAAe,IAAI;IACnB,QAAQ,IAAI;IACZ,KAAK,IAAI;IACT,UAAU,IAAI;IACd,cAAc,IAAI;IAClB,cAAc,IAAI;IAClB,WAAW,IAAI;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B,QAAQ,EAAE,QAAQ,CAAC;IACnB,QAAQ,EAAE,IAAI,EAAE,CAAC;IACjB,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,WAAW,EAAE,MAAM,CAAC;CACvB;AAED;;;GAGG;AACH,qBAAa,WAAW;IACpB;;OAEG;IACH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