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

[Feature Request] Rank the hand for Omaha Hold'em #33

Open
azriel1rf opened this issue Apr 27, 2022 · 1 comment
Open

[Feature Request] Rank the hand for Omaha Hold'em #33

azriel1rf opened this issue Apr 27, 2022 · 1 comment

Comments

@azriel1rf
Copy link

I request the ranking an Omaha hands.

In Omaha Hold'em, four hole card are dealt for players and five cards are dealt on the board.
It's evaluated the best five-cards made from three of five cards on the board and two of four hole cards.

I'm also willing to contribute and send PR.
But, what is the best interface for that?

There are some choices.

Let's say AhAsKhKs in hole cards and QhJhTh9h8h on the board.

Example 1.

let best_card = Hand::new_from_str("AhKhQhJhTh").unwrap();

let hole_card = Hand::new_from_str("AhAsKhKs").unwrap();
let board = Hand::new_from_str("QhJhTh9h8h").unwrap();
let omaha_state = Omaha(board, hole_card);
assert_eq!(omaha_state.rank(), best_card.rank());

Example 2.

let best_card = Hand::new_from_str("AhKhQhJhTh").unwrap();

let hole_card = Hand::new_from_str("AhAsKhKs").unwrap();
let board = Hand::new_from_str("QhJhTh9h8h").unwrap();

assert_eq!(hole_card.rank_omaha(board), best_card.rank());

Example 3.

let best_card = Hand::new_from_str("AhKhQhJhTh").unwrap();

let hole_card = Hand::new_from_str("AhAsKhKs").unwrap();
let board = Hand::new_from_str("QhJhTh9h8h").unwrap();

assert_eq!(Rank::from_cards(Rule::Omaha, board, hole_card), best_card.rank());
@elliottneilclark
Copy link
Owner

Omaha would be a welcome addition for sure. My first thought would be to make it a ranker param.

let whole_hand = Hand::new_from_str("AhKhQhJhThQhJhTh9h8h").unwrap();
let rank = whole_hand.rank_omaha().unwrap();

Something like that. Hand is right now just a collection of cards that can be put together and ranked. Omaha has different requirements about what the possible combinations are.

What do you think?

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

2 participants