Use @pokertools/engine and evaluator for poker rules and hand ranking
Replace the hand-rolled betting rules, side pots, showdown and hand evaluator with the published @pokertools/engine and @pokertools/evaluator libraries (MIT, pinned to 2.1.0). - server/hand.js now wraps a PokerEngine per hand: it maps seats, mirrors stacks, staggers the all-in runout, and pays host-chosen winners on cash-only tables. - server/cards.js and server/ai.js use the library evaluator. - Out-of-turn folds go through the engine's stand; all-in hands stay live when the player leaves; uncalled bets return to a leaver. - The engine refuses some check-able folds that would leave a side pot without eligible players; those now return a message (or check for a leaving player) instead of crashing. - BB must be greater than SB (engine requirement); Node >= 24. - Tests rig cards via engine snapshots and cover the new edge cases. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
02c8e76237
commit
d92953a270
9 files changed
+410
-382
No files matched your search
Generated
+52
@@ -8,6 +8,8 @@
|
||||
"name": "friends-holdem",
|
||||
"version": "0.1.0",
|
||||
"dependencies": {
|
||||
"@pokertools/engine": "2.1.0",
|
||||
"@pokertools/evaluator": "2.1.0",
|
||||
"express": "^4.22.3",
|
||||
"socket.io": "^4.8.4"
|
||||
},
|
||||
@@ -15,6 +17,47 @@
|
||||
"node": ">=18"
|
||||
}
|
||||
},
|
||||
"node_modules/@pokertools/engine": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pokertools/engine/-/engine-2.1.0.tgz",
|
||||
"integrity": "sha512-/3kXKpFf6nHygWQuX1AMu8yQa6HW9RhLW7TkOZJnXSESJ/vs00YWs976F2zNzqnlBPK90LvRSw4ZyqwK+9Ajow==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"@pokertools/evaluator": "2.1.0",
|
||||
"@pokertools/types": "2.1.0"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^24.15.0 || >=26.0.0",
|
||||
"npm": ">=12.2.0"
|
||||
},
|
||||
"peerDependencies": {
|
||||
"@pokertools/evaluator": "2.1.0",
|
||||
"@pokertools/types": "2.1.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@pokertools/evaluator": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pokertools/evaluator/-/evaluator-2.1.0.tgz",
|
||||
"integrity": "sha512-9ZmmwrA9g2IvKST2y0HrdiwTGIM6uoMoom9fXq0ZfQHGcd24X5ydQJi3S5ciR/LFjSN4T2EakwXqVED6tuWD+w==",
|
||||
"license": "MIT",
|
||||
"engines": {
|
||||
"node": "^24.15.0 || >=26.0.0",
|
||||
"npm": ">=12.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@pokertools/types": {
|
||||
"version": "2.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@pokertools/types/-/types-2.1.0.tgz",
|
||||
"integrity": "sha512-FBKLd3cczFfHQAH4DY0n+VEcdccEW7C5wa4PaAA/jaBvmYo0OU7PBHduPEhcO3ZpWBAr3KjW1ESzaajhlvTzCw==",
|
||||
"license": "MIT",
|
||||
"dependencies": {
|
||||
"zod": "^4.6.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": "^24.15.0 || >=26.0.0",
|
||||
"npm": ">=12.2.0"
|
||||
}
|
||||
},
|
||||
"node_modules/@socket.io/component-emitter": {
|
||||
"version": "3.1.2",
|
||||
"resolved": "https://registry.npmjs.org/@socket.io/component-emitter/-/component-emitter-3.1.2.tgz",
|
||||
@@ -1078,6 +1121,15 @@
|
||||
"optional": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"node_modules/zod": {
|
||||
"version": "4.6.7",
|
||||
"resolved": "https://registry.npmjs.org/zod/-/zod-4.6.7.tgz",
|
||||
"integrity": "sha512-g8W2D2kU6a8untc053fX1uVBKzM7yqAxW/3zwk83+6RyF2+SKOuV+c0wBDhUwzV1PaGapmZH+rmcUzPf+3CGwg==",
|
||||
"license": "MIT",
|
||||
"funding": {
|
||||
"url": "https://github.com/sponsors/colinhacks"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user