Give CPUs distinct personalities built on different poker libraries
Each CPU now thinks with one of four engines, each backed by a different published library (pinned versions): - montecarlo (@pokertools/evaluator): the existing balanced Monte Carlo equity player, moved to server/bots/montecarlo.js. - calculator (poker-calculations): the library's decideAction over the table state; push/fold below 12BB via its jam breakeven equity. Skipped automatically if the native addon cannot load. - range (poker-utils): tight player; preflop by hand-strength percentile, postflop equity vs an estimated opponent range, bluffs only when alpha/bluffEV say they pay. - madehand (pokersolver): loose, sticky player that only looks at the made hand and draws. server/ai.js assigns a mix of engines per table (makeStyles), falls back to the Monte Carlo engine on errors, and legalizes every decision. The engine and its parameters stay server-side; players cannot tell which library a CPU uses. Tests cover every engine and the no-leak rule. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
d92953a270
commit
3116b1da9f
11 files changed
+702
-131
No files matched your search
+3
-2
@@ -30,7 +30,7 @@ class Table {
|
||||
|
||||
// { token, name, stack, buyIns, sittingOut, left, bot, style }
|
||||
// left: ハンド中に退席した人。ハンドが終わるまで席を予約しておく
|
||||
// bot : CPU プレイヤー(style は思考の性格)
|
||||
// bot : CPU プレイヤー(style は思考の種類と性格。ブラウザには渡さない)
|
||||
this.seats = new Array(this.maxSeats).fill(null);
|
||||
this.botTurn = null; // { key, at }: CPU が行動する時刻
|
||||
if (this.mode === 'cpu') this.seatBots(opts.cpuCount);
|
||||
@@ -58,6 +58,7 @@ class Table {
|
||||
const j = crypto.randomInt(i + 1);
|
||||
[names[i], names[j]] = [names[j], names[i]];
|
||||
}
|
||||
const styles = ai.makeStyles(n); // 思考(使うライブラリ)はなるべくばらけさせる。画面には出さない
|
||||
for (let k = 0; k < n; k++) {
|
||||
this.seats[k + 1] = {
|
||||
token: crypto.randomBytes(16).toString('hex'), // ブラウザには渡さない
|
||||
@@ -67,7 +68,7 @@ class Table {
|
||||
sittingOut: false,
|
||||
left: false,
|
||||
bot: true,
|
||||
style: ai.randomStyle(),
|
||||
style: styles[k],
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user