//! Breite Ausnutzung (`engine::read_exploit`, Schalter GEGNER_BREIT): ein Read, den der Riegel blind //! spielt (Nit, Reg, Maniac), darf nur ueber wenige, begrenzte Kanaele wirken. Hier: der C-Bet-Druck //! gegen einen Folder und das Bluff-Veto gegen einen Caller, je am konkreten Spot; Station und Schalter //! aus lassen die Entscheidung unberuehrt. use rechner::card::Card; use rechner::engine::read_exploit::{postflop_with, Channels}; use rechner::exploit::profile::Profile; use rechner::game::{ActionKind, ActionRecord, Choice, Decision, SeenAction, Spot, Street, Villain}; use rechner::read::hand_read::read; use rechner::variant::Variant; fn rec(street: Street, seat: u8, action: SeenAction, amount: Option) -> ActionRecord { ActionRecord { street, seat, action, amount } } /// Heads-up flop, hero (seat 0) raised preflop, villain (seat 1) called and checked the flop. fn flop(hero: &str, profile: Option) -> Spot { Spot { variant: Variant::Nlhe, big_blind: 1.0, seats: 2, hero_seat: 0, button_seat: Some(0), hero_cards: Card::parse_list(hero).unwrap(), board: Card::parse_list("Kc 8d 3s").unwrap(), street: Street::Flop, pot: 6.0, to_call: 0.0, hero_stack: 97.0, min_raise_to: Some(1.0), max_raise_to: Some(97.0), legal: vec![ActionKind::Check, ActionKind::Raise], allowed_sizes: None, villains: vec![Villain { seat: 1, stack: 97.0, folded: false, profile }], seed: 7, history: vec![ rec(Street::Preflop, 0, SeenAction::Raise, Some(3.0)), rec(Street::Preflop, 1, SeenAction::Call, Some(3.0)), rec(Street::Flop, 1, SeenAction::Check, None), ], } } fn nit(fold_to_cbet: f64, confidence: f64) -> Option { Some(Profile { vpip: Some(0.14), pfr: Some(0.11), fold_to_bet: Some(0.70), aggression: Some(0.25), fold_to_cbet: Some(fold_to_cbet), confidence: Some(confidence), ..Profile::default() }) } fn decision(choice: Choice, equity: f64) -> Decision { Decision::new(choice, 0.6, "heuristic").with_equity(equity) } #[test] fn ein_sicherer_cbet_folder_bekommt_die_kleine_cbet() { let spot = flop("7h 6h", nit(0.85, 0.8)); let hand = read(&spot.rules(), &spot.hero_cards, &spot.board).unwrap(); let ch = Channels::parse("c"); let d = postflop_with(ch, &spot, &hand, decision(Choice::Check, 0.2)); match d.choice { Choice::Raise { to } => assert!(to > 0.0 && to <= 0.5 * spot.pot, "small c-bet, got {to}"), other => panic!("expected a c-bet, got {other:?}"), } assert!(d.reason.starts_with("breit:c")); // Schalter aus, duenner Read, Station: unberuehrt. let base = decision(Choice::Check, 0.2); assert_eq!(postflop_with(Channels::default(), &spot, &hand, base.clone()), base); let thin = flop("7h 6h", nit(0.85, 0.1)); assert_eq!(postflop_with(ch, &thin, &hand, base.clone()), base); let station = flop( "7h 6h", Some(Profile { vpip: Some(0.6), pfr: Some(0.05), fold_to_bet: Some(0.2), fold_to_cbet: Some(0.85), confidence: Some(0.9), ..Profile::default() }), ); assert_eq!(postflop_with(ch, &station, &hand, base.clone()), base); } #[test] fn gegen_einen_sicheren_caller_kein_reiner_bluff() { let caller = Some(Profile { vpip: Some(0.26), pfr: Some(0.2), fold_to_bet: Some(0.15), aggression: Some(0.5), fold_to_cbet: Some(0.15), confidence: Some(0.9), ..Profile::default() }); let spot = flop("5h 4d", caller); let hand = read(&spot.rules(), &spot.hero_cards, &spot.board).unwrap(); let bet = decision(Choice::Raise { to: 4.0 }, 0.15); let d = postflop_with(Channels::parse("b"), &spot, &hand, bet.clone()); assert_eq!(d.choice, Choice::Check, "{}", d.reason); assert!(d.reason.starts_with("breit:b")); // Gegen einen Folder bleibt der Bluff. let folder = flop("5h 4d", nit(0.85, 0.9)); assert_eq!(postflop_with(Channels::parse("b"), &folder, &hand, bet.clone()), bet); }