65 lines
2.7 KiB
Rust
65 lines
2.7 KiB
Rust
//! PLO6: six-card Omaha as a variant of its own.
|
|
//!
|
|
//! What is asserted here is the contract, not a solver: the variant parses, carries six hole
|
|
//! cards, uses exactly two of them at showdown, is pot limit, and is no longer swallowed by the
|
|
//! "anything but 2/4/5 cards" fallback of the preflop percentile.
|
|
|
|
use pokerfreak::card::Card;
|
|
use pokerfreak::hand::showdown::best as best_hand;
|
|
use pokerfreak::preflop::hand_percentile::percentile;
|
|
use pokerfreak::variant::{rules, HoleUsage, SizingRule, Variant};
|
|
|
|
fn hand(text: &str) -> Vec<Card> {
|
|
Card::parse_list(text).expect("gueltige Karten")
|
|
}
|
|
|
|
#[test]
|
|
fn parses_and_is_named() {
|
|
assert_eq!(Variant::parse("PLO6"), Some(Variant::Plo6));
|
|
assert_eq!(Variant::Plo6.name(), "PLO6");
|
|
assert!(Variant::ALL.contains(&Variant::Plo6), "PLO6 gehoert in die Variantenliste");
|
|
}
|
|
|
|
#[test]
|
|
fn six_hole_cards_pot_limit_two_of_them() {
|
|
let r = rules(Variant::Plo6);
|
|
assert_eq!(r.hole_cards, 6);
|
|
assert_eq!(r.hole_usage, HoleUsage::ExactlyTwoHole);
|
|
assert_eq!(r.sizing, SizingRule::PotLimit);
|
|
}
|
|
|
|
/// Sechs Handkarten werden bewertet - und die Zwei-Handkarten-Regel beisst zu: das dritte Ass
|
|
/// darf nicht mit hinein, das Ergebnis ist genau das der besten zwei Handkarten.
|
|
#[test]
|
|
fn exactly_two_hole_cards_bites() {
|
|
let board = hand("KS KD KH 7C 8C");
|
|
let sechs = best_hand(HoleUsage::ExactlyTwoHole, &hand("AS AD AH 2C 3C 4C"), &board)
|
|
.expect("gueltiges Sechser-Omaha");
|
|
let zwei = best_hand(HoleUsage::ExactlyTwoHole, &hand("AS AD"), &board).expect("gueltig");
|
|
assert_eq!(sechs, zwei, "das dritte Ass handelt nicht mit: zwei Karten, nicht drei");
|
|
|
|
// Gegenprobe nach unten: ohne das zweite Ass wird es schwaecher - die Regel ist also keine
|
|
// Nulloperation.
|
|
let ohne_zweites_ass = best_hand(HoleUsage::ExactlyTwoHole, &hand("AS 2C"), &board).expect("gueltig");
|
|
assert!(sechs > ohne_zweites_ass);
|
|
}
|
|
|
|
/// Die andere Varianten bleiben unberuehrt.
|
|
#[test]
|
|
fn plo5_unchanged() {
|
|
assert!(percentile(Variant::Plo5, &hand("AS AD KS KD QH")) < 0.20);
|
|
assert_eq!(rules(Variant::Plo5).hole_cards, 5);
|
|
}
|
|
|
|
/// Der Prozentrang ist weder konstant noch der Rueckfall `1.0` - und ordentlich sortiert.
|
|
#[test]
|
|
fn percentile_is_ordered_and_reaches_the_top_band() {
|
|
let top = percentile(Variant::Plo6, &hand("AS AD KS KD QH JC"));
|
|
let muell = percentile(Variant::Plo6, &hand("2C 3D 7H 8S 9C 4D"));
|
|
assert!(top < muell, "das Doppel-Ass-Paar muss besser sein: {top} < {muell}");
|
|
assert!(top < 0.20, "ein Top-Sechser darf nicht wie Ausschuss zaehlen: {top}");
|
|
assert!(muell > 0.30, "ein Blinder darf nicht wie der Beste zaehlen: {muell}");
|
|
// Fuenf Karten sind kein Sechser: der Rueckfall bleibt erkennbar.
|
|
assert_eq!(percentile(Variant::Plo6, &hand("AS AD KS KD QH")), 1.0);
|
|
}
|