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

Refactor _evaluate_omaha_cards and simplify it #110

Merged
merged 3 commits into from
Oct 19, 2024

Conversation

ParthShitole
Copy link
Contributor

@ParthShitole ParthShitole commented Oct 18, 2024

The _evaluate_omaha_cards is refactored and four new methods are added to simplify the orignal function:

def _count_suits

  • This function counts the occurrences of each suit in the given list of cards (both community and hole cards).
    It returns a list of counts indexed by suit.

def _determine_flush_suit

  • This function determines if a flush is possible based on the counts of suits in both community and hole cards.
    It returns the flush suit index or -1 if no flush is possible.

def calculate_flush_value

  • This function calculates the value associated with the flush based on the flush suit, community cards, and hole cards.

def calculate_non_flush_value

  • This function computes the value of the hand when no flush is present.
    Additionally magic numbers are replaced with named constants.

Closes #92

@HenryRLee HenryRLee requested a review from azriel1rf October 19, 2024 02:00
Copy link
Owner

@HenryRLee HenryRLee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. Thanks for your contribution!

@ParthShitole
Copy link
Contributor Author

Can you Merge this PR

@HenryRLee HenryRLee merged commit adbcca1 into HenryRLee:develop Oct 19, 2024
12 checks passed
@ParthShitole ParthShitole deleted the refactor-omaha branch October 19, 2024 11:40
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

Successfully merging this pull request may close these issues.

Refactor _evaluate_omaha_cards function for simplicity
2 participants