← Back to Skills Marketplace
dream-pig

德州扑克

by DreamPig · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ✓ Security Clean
190
Downloads
0
Stars
1
Active Installs
2
Versions
Install in OpenClaw
/install holdem-poker
Description
Text-based Texas Hold'em poker game with auto AI players for OpenClaw
README (SKILL.md)

Texas Hold'em Poker Skill

A 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.

Features

  • Full Texas Hold'em rules implementation
  • Automatic AI players for other positions
  • Card suits displayed with emoji symbols
  • Support for multiple game rounds
  • Proper betting rounds: pre-flop, flop, turn, river
  • Chat-friendly output format

How to Use

Start a New Game

node {baseDir}/scripts/final-game.js

Play Commands

During the game, use these commands:

Text Commands

  1. fold - Fold your hand and exit the current round
  2. check - Check (pass without betting)
  3. call - Call the current bet
  4. bet [amount] - Place a bet (e.g., "bet 5")
  5. allin - Go all-in with your remaining chips
  6. next - Start the next round after a game ends
  7. help - Show available commands
  8. quit - Exit the game

Number Commands (Quick Access)

  1. 1 = fold
  2. 2 = check
  3. 3 = call
  4. 4 N = bet N (e.g., "4 5" = bet 5)
  5. 5 = allin

Example Usage:

  • 1 (fold) = fold
  • 2 (check) = check
  • 3 (call) = call
  • 4 5 (bet 5) = bet 5
  • 5 (allin) = allin

QQ Chat Integration

For 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:

  • AI hole cards are saved but hidden as "??" until showdown
  • AI decisions are automatic and immediate after your action
  • At showdown, all cards are revealed simultaneously
  • This creates a fair, turn-based experience perfect for chat interfaces

Security & Fair Play:

  • AI hole cards are stored securely and never revealed prematurely
  • Game state is validated at each step to ensure fair play
  • Complete game history is logged for review
  • No player can see another's hole cards before showdown

Game Flow

  1. Pre-flop: Small blind and big blind forced bets, 2 hole cards dealt
  2. Flop: 3 community cards revealed, first betting round
  3. Turn: 4th community card revealed, second betting round
  4. River: 5th community card revealed, final betting round
  5. Showdown: Winners determined by best 5-card hand

Card Notation

  • Suits: ❤️ (Hearts), ♦️ (Diamonds), ♣️ (Clubs), ♠️ (Spades)
  • Values: A, K, Q, J, 10, 9, 8, 7, 6, 5, 4, 3, 2

Chat Integration Example

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...

Hand Rankings (Strongest to Weakest)

  1. Royal Flush - A K Q J 10 same suit
  2. Straight Flush - Five consecutive same suit
  3. Four of a Kind - Four same values
  4. Full House - Three of a kind + pair
  5. Flush - Five same suit
  6. Straight - Five consecutive different suits
  7. Three of a Kind - Three same values
  8. Two Pair - Two different pairs
  9. One Pair - One pair
  10. High Card - Highest card

API Usage

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();

Configuration

Edit references/config.json to change:

  • Starting chip amount
  • Blind amounts
  • Number of AI players
  • Auto-play delay speed

Files

  • scripts/simple-game.mjs - Main game logic
  • scripts/game.mjs - Full interactive CLI version
  • references/config.json - Game configuration

💰 资金追踪与常见问题

资金问题记录

🔴 问题:资金总额不匹配

根本原因: AI玩家弃牌时,已投入的筹码被错误退还,而不是保留在底池中 修复方案:

  • 修改scripts/final-game.js中的AI弃牌逻辑
  • AI弃牌时,已投入的筹码正确保留在底池
  • 确保player.isActive = false不会退还已投入筹码

修复代码:

// 弃牌:保留已投入的筹码在底池
player.isActive = false;
// 已投入的筹码 already in pot, don't return

✅ 资金验证公式

总资金 = 玩家1筹码 + 玩家2筹码 + 玩家3筹码 + 底池

验证时机:

  • 每局开始前
  • 每次下注后
  • 摊牌结算后

预期结果: 总资金始终保持初始值(默认$300)

🎯 预防措施

资金追踪检查点

  1. 盲注阶段: 验证盲注正确扣除
  2. 下注阶段: 验证每次下注正确转移到底池
  3. 弃牌处理: 验证弃牌玩家已投入筹码保留在底池
  4. 摊牌结算: 验证赢家获得底池,总资金不变

自动化测试

建议添加资金验证测试:

function validateTotalChips() {
  const total = players.reduce((sum, p) => sum + p.chips, 0) + pot;
  return total === INITIAL_TOTAL_CHIPS;
}

🐛 常见Bug及修复

1. 筹码负数问题

原因: 下注金额超过玩家筹码 修复: 添加筹码不足检查,自动转为全下

2. 底池计算错误

原因: 玩家弃牌时筹码退还 修复: 弃牌只标记isActive = false,不修改筹码

3. AI决策逻辑错误

原因: 手牌强度计算不准确 修复: 优化evaluateHandStrength函数

Usage Guidance
This skill appears to be a local Node-based poker game and is coherent with its description. Before running: (1) ensure you have Node installed; (2) review the bundled scripts if you are concerned (they appear to only manipulate in-memory game state and local config); (3) run in a sandbox or non-sensitive environment if you normally avoid running third-party code; (4) note SKILL.md allows editing references/config.json — this is benign for game configuration but treat it like any file write. If you want added assurance, run the game with network access disabled or inspect the full game.mjs (truncated in the listing) to confirm no fs/network calls beyond local config access.
Capability Analysis
Type: OpenClaw Skill Name: holdem-poker Version: 1.0.1 The skill bundle implements a text-based Texas Hold'em poker game using Node.js. The provided scripts (scripts/game.mjs, scripts/final-game.js, etc.) contain standard game logic, hand evaluation algorithms, and CLI interaction code without any evidence of malicious behavior, data exfiltration, or unauthorized system access. Although SKILL.md requests broad permissions like 'Exec' and 'Write', the actual code and instructions are strictly limited to the poker game's functionality, including detailed developer notes in Chinese regarding the fix of a chip-tracking logic bug.
Capability Assessment
Purpose & Capability
Name/description (Texas Hold'em) matches the artifacts: JS CLI scripts, package.json, and SKILL.md. The only required binary is node, which is appropriate for running the included scripts. No unexpected credentials, binaries, or config paths are requested.
Instruction Scope
SKILL.md instructs running local scripts (e.g., node {baseDir}/scripts/final-game.js), using local config (references/config.json), and interacting via text commands. The instructions do not direct the agent to read unrelated system files, environment variables, or to send data to external endpoints. Allowed tools include Exec/Read/Write which are needed to run and optionally edit local files; this scope is proportional to the stated purpose.
Install Mechanism
No remote install/download is declared. Code files and a package.json are bundled with the skill. package.json has no external dependencies beyond Node and a CLI entrypoint. There are no download URLs, archives to extract, or third-party package installs specified in the skill metadata.
Credentials
The skill requests no environment variables or credentials. The code reads/writes only within the project (SKILL.md suggests editing references/config.json); there are no uses of cloud keys or unrelated secrets in the source files shown.
Persistence & Privilege
Flags show always: false (no forced always-on). The skill does not attempt to modify other skills or global agent configuration. It contains code that can be executed locally but does not persist elevated privileges or register itself ubiquitously.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install holdem-poker
  3. After installation, invoke the skill by name or use /holdem-poker
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
- Documentation improved: Removed redundant and overly detailed status/FAQ sections. - Changelog and internal validation record sections have been trimmed for clarity. - Instructions, command lists, and gameplay explanations remain unchanged. - No code or functionality changes in this release.
v1.0.0
- Initial release of text-based Texas Hold'em poker for OpenClaw chat - Play as the small blind, with automatic AI players for remaining seats - Full poker rules, rounds, and chat-friendly command formats (text and numbers) - Card suits displayed with emojis for clear visuals in chat - Thorough documentation and examples for use and API integration - Funds tracking bug fix: AI folded chips kept in pot, ensuring total chips consistency
Metadata
Slug holdem-poker
Version 1.0.1
License MIT-0
All-time Installs 1
Active Installs 1
Total Versions 2
Frequently Asked Questions

What is 德州扑克?

Text-based Texas Hold'em poker game with auto AI players for OpenClaw. It is an AI Agent Skill for Claude Code / OpenClaw, with 190 downloads so far.

How do I install 德州扑克?

Run "/install holdem-poker" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is 德州扑克 free?

Yes, 德州扑克 is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does 德州扑克 support?

德州扑克 is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created 德州扑克?

It is built and maintained by DreamPig (@dream-pig); the current version is v1.0.1.

💬 Comments