@idealic/poker-engine
Version:
Professional poker game engine and hand evaluator with built-in iterator utilities
24 lines • 852 B
JavaScript
/**
* Custom CSV serialization format for hands
* @param hand - Hand to serialize
* @returns CSV string representation
*/
export function toCSV(hand) {
const header = 'variant,players,actions,minBet,currency';
const playersList = hand.players.join(';');
const actionsList = hand.actions.join(';');
const minBet = 'minBet' in hand ? hand.minBet : '';
return `${header}\n${hand.variant},"${playersList}","${actionsList}",${minBet},${hand.currency || 'USD'}`;
}
/**
* Custom compact format for logging
* @param hand - Hand to serialize
* @returns Compact string representation
*/
export function toCompact(hand) {
return `${hand.variant}[${hand.players.length}p]:${hand.actions.length}a`;
}
// Register the new methods on the Hand namespace
Hand.toCSV = toCSV;
Hand.toCompact = toCompact;
//# sourceMappingURL=custom.js.map