Install
openclaw skills install holdem-pokerText-based Texas Hold'em poker game with auto AI players for OpenClaw
openclaw skills install holdem-pokerA text-based Texas Hold'em poker game where you control the small blind player, and AI controls other players automatically. Designed for OpenClaw chat interactions.
node {baseDir}/scripts/final-game.js
During the game, use these commands:
Example Usage:
1 (fold) = fold2 (check) = check3 (call) = call4 5 (bet 5) = bet 55 (allin) = allinFor OpenClaw chat integration, the game is designed to work in a turn-based fashion:
User: start
Bot: 🃏 Round 1 - PRE-FLOP
You: J♦️ 8♣️ | $99
AI Players: ?? | $98, $100
Community: A❤️ 2❤️ 3❤️
Pot: $5 | Current Bet: $2
Action?
User: call
Bot: You called $1
AI players act automatically...
AI Player Handling:
Security & Fair Play:
User: start
Bot: 🃏 Texas Hold'em - Round 1
You (Small Blind): J♦️ 8♣️ | Chips: $99
Community: A❤️ 2❤️ 3❤️
Pot: $5 | Current Bet: $2
Action? [fold/check/call/bet/allin]
User: check
Bot: You checked. AI players act automatically...
import { PokerGame } from './scripts/simple-game.mjs';
const game = new PokerGame();
const state = game.startNewRound();
console.log(state);
// Player actions
const result = game.playerAction('call');
console.log(result);
// AI acts automatically
const newState = await game.playAIActions();
Edit references/config.json to change:
scripts/simple-game.mjs - Main game logicscripts/game.mjs - Full interactive CLI versionreferences/config.json - Game configuration根本原因: AI玩家弃牌时,已投入的筹码被错误退还,而不是保留在底池中 修复方案:
scripts/final-game.js中的AI弃牌逻辑player.isActive = false不会退还已投入筹码修复代码:
// 弃牌:保留已投入的筹码在底池
player.isActive = false;
// 已投入的筹码 already in pot, don't return
总资金 = 玩家1筹码 + 玩家2筹码 + 玩家3筹码 + 底池
验证时机:
预期结果: 总资金始终保持初始值(默认$300)
建议添加资金验证测试:
function validateTotalChips() {
const total = players.reduce((sum, p) => sum + p.chips, 0) + pot;
return total === INITIAL_TOTAL_CHIPS;
}
原因: 下注金额超过玩家筹码 修复: 添加筹码不足检查,自动转为全下
原因: 玩家弃牌时筹码退还
修复: 弃牌只标记isActive = false,不修改筹码
原因: 手牌强度计算不准确
修复: 优化evaluateHandStrength函数