A comprehensive Node.js library for managing Deuce-to-Seven Triple Draw Lowball poker games. Built with the same robust architecture as the poker-game-manager but specifically designed for triple-draw variants.
- ✅ Full 2-7 Triple Draw game logic implementation
- ✅ Lowball hand evaluation (straights and flushes count against you)
- ✅ Three drawing rounds with betting after each
- ✅ Support for limit, pot-limit, and no-limit betting structures
- ✅ Event-driven architecture for easy integration
- ✅ Integer-validated chip management (prevents floating point errors)
- ✅ Dead button rule support
- ✅ Comprehensive position tracking
- ✅ Side pot management for all-in scenarios
- ✅ Proper 4-raise betting cap enforcement (5 total bets max per round)
- ✅ Support for negative chips in simulation mode (allowNegativeChips option)
- ✅ Fixed position support for deterministic testing (fixedPositions option)
npm install @jkraybill/triple-draw-manager@1.1.5Note: Version 1.1.5 includes critical bug fixes for betting cap enforcement and negative chip handling.
import { Table, Player } from '@jkraybill/triple-draw-manager';
// Create a custom player class
class MyPlayer extends Player {
async getAction(gameState) {
// Implement your betting logic
return { action: 'call' };
}
async getDrawAction(gameState) {
// Implement your drawing logic
return { cardsToDiscard: 2, discardIndices: [0, 1] };
}
}
// Create a table
const table = new Table({
blinds: { small: 10, big: 20 },
maxPlayers: 6,
limitBetting: true,
betLimit: 20
});
// Add players
const player1 = new MyPlayer({ id: 'p1', chips: 1000 });
const player2 = new MyPlayer({ id: 'p2', chips: 1000 });
table.addPlayer(player1);
table.addPlayer(player2);
// Start the game
await table.tryStartGame();- Pre-Draw Betting: Initial betting round after cards are dealt
- First Draw: Players can discard 0-5 cards and draw new ones
- Post-First Draw Betting: Betting round after first draw
- Second Draw: Second drawing opportunity
- Post-Second Draw Betting: Betting round after second draw
- Third Draw: Final drawing opportunity
- Post-Third Draw Betting: Final betting round
- Showdown: Best low hand wins (7-5-4-3-2 is the best possible hand)
In 2-7 Triple Draw, the LOWEST hand wins:
- 7-5-4-3-2 (The Wheel/Number One) - Best possible hand
- 8-6-4-3-2 (Number Two)
- 8-6-5-3-2 (Number Three)
- 8-6-5-4-2 (Number Four)
- 8-6-5-4-3 (Number Five)
- 8-7-4-3-2 (Eight-Seven)
- ...continuing with worse hands...
- Pairs - Worse than any no-pair hand
- Two Pair
- Three of a Kind
- Straights - Count against you!
- Flushes - Count against you!
- Full House
- Four of a Kind
- Straight Flush - Worst possible hand
Remember:
- Aces are ALWAYS high (not low)
- Straights and flushes count AGAINST you
- The best hand has no pairs, no straight, no flush
The library emits various events throughout the game:
player:joined- Player joins the tableplayer:left- Player leaves the tablegame:started- New hand beginshand:completed- Hand ends with results
blind:posted- Blind postedbetting:round:started- Betting round beginsplayer:to:act- Player's turn to actplayer:bet- Player makes a betplayer:raised- Player raisesplayer:called- Player callsplayer:folded- Player foldsdraw:phase:started- Draw phase beginsplayer:stood-pat- Player draws 0 cardsplayer:drew:cards- Player draws cardshand:ended- Showdown and winners
const table = new Table({
id: 'table-1', // Optional table ID
variant: '2-7-triple-draw', // Game variant (default)
maxPlayers: 6, // Maximum players (default: 6)
minPlayers: 2, // Minimum to start (default: 2)
blinds: {
small: 10, // Small blind amount (must be integer)
big: 20 // Big blind amount (must be integer)
},
limitBetting: true, // Use fixed limit betting (default: true)
betLimit: 20, // Fixed bet amount (default: big blind)
timeout: 30000, // Action timeout in ms (default: 30000)
simulationMode: false, // Fast execution without delays (default: false)
dealerButton: 0 // Initial button position (default: random)
});For advanced usage, you can directly instantiate the game engine:
const engine = new TripleDrawGameEngine({
players: [player1, player2, player3],
blinds: { small: 10, big: 20 },
dealerButton: 0, // Specific button position (0-based index)
limitBetting: true, // Enforce limit betting rules
betLimit: 20, // Fixed bet/raise amount for limit games
timeout: 30000, // Player action timeout in ms
fixedPositions: false, // Don't rotate button/blinds between hands
allowNegativeChips: false, // Allow players to go negative (for simulations)
simulationMode: false // Fast execution without delays
});Players must extend the base Player class and implement:
class MyPlayer extends Player {
// Required: Handle betting decisions
async getAction(gameState) {
return {
action: 'call', // 'fold', 'check', 'call', 'bet', 'raise'
amount: 20 // For bet/raise actions
};
}
// Required: Handle drawing decisions
async getDrawAction(gameState) {
return {
cardsToDiscard: 3, // 0-5 cards
discardIndices: [0, 2, 4] // Which cards to discard
};
}
}See the /examples directory for complete working examples:
simple-game.js- Basic game with bot playersSimpleBot.js- Example bot implementation
npm test # Run all tests
npm run test:watch # Watch mode
npm run test:coverage # Coverage reportMIT
Based on the architecture of poker-game-manager.