A library to help with any Rust code dealing with poker. This includes card values, suits, hands, hand ranks, 5 card hand strength calculation, 7 card hand strength calulcation, and monte carlo game simulation helpers.
externcrate rs_poker;users_poker::core::Hand;users_poker::holdem::MonteCarloGame;constGAMES_COUNT:i32=3_000_000;constSTARTING_HANDS:[&str;2]=["Adkh","8c8s"];fnmain(){let hands =STARTING_HANDS.iter().map(|s|Hand::new_from_str(s).expect("Should be able to create a hand.")).collect();letmut g =MonteCarloGame::new(hands).expect("Should be able to create a game.");letmut wins:[u64;2]=[0,0];for_in0..GAMES_COUNT{let r = g.simulate();
g.reset();
wins[r.0.ones().next().unwrap()]+=1}let normalized:Vec<f64>= wins
.iter().map(|cnt|*cnt asf64/GAMES_COUNTasf64).collect();println!("Starting Hands =\t{:?}",STARTING_HANDS);println!("Wins =\t\t\t{:?}", wins);println!("Normalized Wins =\t{:?}", normalized);}