//! Extension field `villains[].marke`: the client's own label of a player, sent by the shell. //! //! A beginner or fish mark stands in for numbers we do not have yet: it fills the profile fields //! that are missing, measured values win. Unknown marks change nothing. mod support; use rechner::wire::respond::respond; use support::{action, cards_json, field, short}; const STATION: &str = r#","profile":{"vpip":0.55,"pfr":0.05,"foldToBet":0.15,"aggression":0.2}"#; const NIT: &str = r#","profile":{"vpip":0.11,"pfr":0.08,"foldToBet":0.8,"aggression":0.15}"#; /// The button first in; the two blinds carry `extra` (a mark, a profile or both). fn steal(hero: &str, extra: &str) -> String { format!( r#"{{"variant":"NLHE","bigBlind":1,"seats":6,"heroSeat":6,"buttonSeat":6,"heroCards":{},"street":"PREFLOP","pot":1.5,"toCall":1,"heroStack":100,"minRaiseTo":2,"maxRaiseTo":100,"legalActions":["FOLD","CALL","RAISE"],"villains":[{{"seat":1,"stack":100,"folded":false{extra}}},{{"seat":2,"stack":100,"folded":false{extra}}}]}}"#, cards_json(&short(hero)), ) } /// K7o: an equilibrium open, not stolen against stations (`pipeline_bluff`). const HERO: &str = "Kd 7c"; #[test] fn a_beginner_mark_changes_the_recommendation() { assert_eq!(action(&respond(&steal(HERO, ""))), "RAISE"); assert_eq!(action(&respond(&steal(HERO, r#","marke":"Anfaenger""#))), "FOLD"); } #[test] fn a_fish_mark_counts_like_a_beginner() { assert_eq!(respond(&steal(HERO, r#","marke":"FISH""#)), respond(&steal(HERO, r#","marke":"Anfaenger""#))); } #[test] fn an_unknown_mark_changes_nothing() { assert_eq!(respond(&steal(HERO, r#","marke":"VIP""#)), respond(&steal(HERO, ""))); } #[test] fn measured_values_beat_the_mark() { let measured = format!(r#","marke":"Anfaenger"{NIT}"#); assert_eq!(respond(&steal(HERO, &measured)), respond(&steal(HERO, NIT))); assert_ne!(respond(&steal(HERO, &measured)), respond(&steal(HERO, STATION))); } #[test] fn a_mark_fills_only_the_missing_fields() { // vpip measured tight, fold-to-bet from the mark: not the same player as the mark alone. let partial = r#","marke":"Anfaenger","profile":{"vpip":0.11,"pfr":0.08}"#; assert_eq!(action(&respond(&steal(HERO, partial))), action(&respond(&steal(HERO, r#","profile":{"vpip":0.11,"pfr":0.08,"foldToBet":0.25,"aggression":0.2}"#)))); } #[test] fn a_mark_that_is_no_text_is_refused() { let out = respond(&steal(HERO, r#","marke":7"#)); assert_eq!(action(&out), "ABSTAIN", "{out}"); assert!(field(&out, "reason").unwrap_or("").contains("marke"), "{out}"); }