Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Identified Issue and Suggested Fix in Odds Calculation Tool (5 Card Omaha Variant) #15

Open
Utkarsh-1803 opened this issue Jan 30, 2024 · 0 comments

Comments

@Utkarsh-1803
Copy link

Utkarsh-1803 commented Jan 30, 2024

I want to express my appreciation for the excellent work on the odds calculation tool. It has proven to be a valuable asset in our poker-related endeavors.
During our usage, we encountered a potential flaw in the tool, specifically in the handling of 5-card Omaha scenarios. After a thorough investigation, we believe we have identified a particular code segment that may be causing an unintended error.

In the Player.js file, located at the path /poker-odds-calc/dist/lib/Player.js, we observed the following lines of code:

setHand(hand) {
    const game = this.Table.getGame();
    if ((game.isTexasHoldem() || game.isSixPlusTexasHoldem()) && hand.length !== 2)
        throw new Error("A Texas hold'em hand must contain exactly 2 cards!");
     if (game.isOmaha() && hand.length !== 4)
        throw new Error("An Omaha hand must contain exactly 4 cards!");
    this.hand = hand.map(c => {
        const card = this.Table.getDeck().getCards().find(card => card.toString() === c);
        if (!card)
            throw new Error(`Card "${c}" not found!`);
        return card.setOwner(this);
    });
    return this;
}

We believe that the condition checking for the length of the hand in Omaha games might be causing unnecessary issues. To address this, we suggest commenting out the relevant lines, as shown below:

setHand(hand) {
    const game = this.Table.getGame();
    if ((game.isTexasHoldem() || game.isSixPlusTexasHoldem()) && hand.length !== 2)
        throw new Error("A Texas hold'em hand must contain exactly 2 cards!");
   // Commenting out the condition for Omaha hand length
    //  if (game.isOmaha() && hand.length !== 4)
       // throw new Error("An Omaha hand must contain exactly 4 cards!");
    this.hand = hand.map(c => {
        const card = this.Table.getDeck().getCards().find(card => card.toString() === c);
        if (!card)
            throw new Error(`Card "${c}" not found!`);
        return card.setOwner(this);
    });
    return this;
}

This modification allows for a smoother handling of 5-card Omaha scenarios. We hope you find this information helpful in maintaining and improving the overall functionality of the odds calculation tool.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant