open_pql/functions/
best_hi_rating.rs

1use super::*;
2
3#[pqlfn(arg, rtn, eval)]
4pub fn best_hi_rating(
5    pid: PQLPlayer,
6    street: PQLStreet,
7    (game, board, player_hands, ratings): (
8        PQLGame,
9        Board,
10        &PlayerHands,
11        &mut BufferRatings,
12    ),
13) -> PQLBoolean {
14    fill_ratings(street, (game, board, player_hands, ratings));
15
16    ratings[pid] == ratings.max()
17}
18
19#[cfg(test)]
20mod tests {
21    use super::*;
22    use crate::*;
23
24    #[test]
25    fn test_best_hi_rating() {
26        let board = board!("2s7hTd Qc As");
27        let hands = vec![cards!("7c Ts"), cards!("2h 2d")];
28        let mut ratings = BufferRatings::new(2);
29
30        assert!(best_hi_rating(
31            1.into(),
32            PQLStreet::Flop,
33            (PQLGame::Holdem, board, &hands, &mut ratings)
34        ));
35    }
36}