UNPKG

card-games-utils

Version:
50 lines 2.15 kB
import { TeenPattiHand } from '../constants/TeenPattiEnum'; import { type StandardCard } from '../interfaces/StandardCard'; import { type Hand } from '../interfaces/Hand'; /** * Class to handle operations of TeenPatti game * @class */ export declare class TeenPatti { /** * @method * @static * Calculates the Teen Patti hand based on an array of three cards. * * @param {[StandardCard, StandardCard, StandardCard]} cards - The array of three cards to be used for the hand calculation. * @returns {keyof typeof TeenPattiHand} - The type of Teen Patti hand that is formed by the given cards. */ static calculateHand(cards: [StandardCard, StandardCard, StandardCard]): keyof typeof TeenPattiHand; /** * @method * @static * convert the given array of 3 cards into Hand interface * * @param {[StandardCard,StandardCard,StandardCard]} cards - the array of cards to be sorted * @returns {Hand} - the sorted array of cards */ static makeHand(cards: [StandardCard, StandardCard, StandardCard]): Hand; /** * @method * @static * Calculates the winner(s) from the array of hands given based on Teen Patti rules * winner could be multiple if players have identical cards with different suites * * @param {Hand[]} hands - The array of hands to be used for winner calculation. * @returns {number[]} - array of indexes of the winner(s) in the array given */ static calculateWinners(hands: Hand[]): number[]; /** * @method * @static * decide if the rank of first given card is higher then second given card * this method should only be used when you have cards with same TeenPattiHand and you want to know the higher ranking * * @param {Hand} hand - the Hand that needs to be compared * @param {Hand} handToCompare - the Hand to compare with * @returns {boolean} - boolean showing is the card higher or not * @throws {Error} - when the comparison results in a tie */ static isRankHigher(hand: Hand, handToCompare: Hand): boolean; } //# sourceMappingURL=TeenPatti.d.ts.map