openpql-runner 0.1.5

A high-performance Rust implementation of Poker Query Language (PQL), enabling SQL-like queries for poker analysis and calculations. This project is a spiritual successor to the original Java implementation developed by Odds Oracle.
Documentation
use super::*;

// TODO: optimize
#[pqlfn]
pub fn ties_hi(ctx: &PQLFnContext, player: PQLPlayer) -> PQLBoolean {
    let player_rating = hi_rating(ctx, player, PQLStreet::River);
    let max_rating = max_hi_rating(ctx, PQLStreet::River);

    if player_rating != max_rating {
        return false;
    }

    for i in 0..ctx.n_players {
        let other = PQLPlayer::from(i);

        if player != other
            && max_rating == hi_rating(ctx, other, PQLStreet::River)
        {
            return true;
        }
    }

    false
}