@idealic/poker-engine
Version:
Professional poker game engine and hand evaluator with built-in iterator utilities
78 lines • 3.08 kB
TypeScript
import type { Player, Game } from '../types';
/**
* Determines if a player can act (not folded, not all-in)
*/
export declare function isPlayerEligibleToAct(player: Player): boolean;
/**
* Checks if we're in a multi-way all-in situation where no more betting is possible.
* This happens when:
* 1. At least one player is all-in
* 2. All remaining players have matched the all-in amount
*
* @example
* - One player all-in, others matched -> true
* - One player all-in, others still betting -> false
* - All players all-in -> true
* - No all-in players -> false
*/
export declare function isMultiWayAllIn(game: Game): boolean;
/**
* Determines if dealer intervention is needed
*/
export declare function isAwaitingDealer(game: Game): boolean;
/**
* Finds the next player who hasn't acted or folded in the current betting round.
* Used to determine whose turn it is to act.
* @param table Current table state
* @returns The next player to act, or undefined if it's dealer's turn
*/
export declare function getActivePlayer(game: Game): number | undefined;
/**
* Determines if it's a specific player's turn to act.
* A player can act if they are the first non-acted, non-folded player in position.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if it's the specified player's turn
*/
export declare function isPlayerTurn(game: Game, playerIndex: number): boolean;
/**
* Determines if a player can check.
* A player can check if they've matched the highest bet and haven't acted yet.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if the player can check
*/
export declare function canCheck(game: Game, position: number): boolean;
/**
* Determines if a player can call.
* A player can call if they face a bet higher than their current bet and have enough chips.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if the player can call
*/
export declare function canCall(game: Game, position: number): boolean;
/**
* Determines if a player can bet.
* A player can bet if there are no existing bets and they have chips.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if the player can bet
*/
export declare function canBet(game: Game, position: number): boolean;
/**
* Determines if a player can raise.
* A player can raise if they face a bet and have enough chips.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if the player can raise
*/
export declare function canRaise(game: Game, position: number): boolean;
/**
* Determines if a player can fold.
* A player can fold if they face a bet higher than their current bet.
* @param table Current table state
* @param playerIndex Index of the player to check
* @returns True if the player can fold
*/
export declare function canFold(game: Game, position: number): boolean;
//# sourceMappingURL=validation.d.ts.map