3 releases
Uses new Rust 2024
| 0.0.3 | Aug 13, 2025 |
|---|---|
| 0.0.2 | Aug 9, 2025 |
| 0.0.1 | Jul 27, 2025 |
#1292 in Database interfaces
Used in cargo-opql
485KB
14K
SLoC
open-pql
⚠️ Work in Progress: This project is currently under active development and is not yet ready for production use.
The core library for Open PQL (Poker Query Language) - a high-performance Rust implementation for poker analysis and calculations.
Overview
This crate provides the fundamental building blocks for poker analysis, including:
- Card and Hand Representation: Efficient data structures for poker cards, hands, and boards
- Hand Evaluation: Fast algorithms for determining hand strength and rankings
- Range Analysis: Tools for working with poker hand ranges and filtering
- Equity Calculations: Precise equity computations for various poker scenarios
- PQL Parser: SQL-like query language parser for poker analysis
- Game Support: Texas Hold'em, Omaha, and other poker variants
Features
benchmark- Enables benchmarking functionalityx86- Optimizations for x86 architecture
Quick Start
use open_pql::*;
// Parse and evaluate poker hands
let hero_hand = parse_hand("AsKs")?;
let villain_range = parse_range("QQ+,AK")?;
let board = parse_board("Ah9s2c")?;
// Calculate equity
let equity = calculate_equity_vs_range(&hero_hand, &villain_range, &board)?;
println!("Hero equity: {:.2}%", equity * 100.0);
// Use PQL queries
let query = "select avg(boardsuitcount(river)) from hero='As9s', villain='*', board='2s3sJh', game='holdem'";
let result = execute_pql_query(query)?;
Architecture
The library is organized into several key modules:
base: Core poker primitives (cards, ranks, suits, hands)functions: PQL function implementations for analysispql_parser: Parser for PQL query languagepql_type: Type system for PQL valuesrange_parser: Parser for poker hand rangesvm: Virtual machine for executing PQL queriesrunner: Query execution engine
Performance
Open PQL is designed for high performance:
- Optimized data structures using bit manipulation
- SIMD instructions for hand evaluation (with
x86feature) - Efficient memory layouts for cache performance
- Compile-time optimizations using procedural macros
Development
Building
# Standard build
cargo build
# With all features
cargo build --features "benchmark,x86"
# Release build with optimizations
cargo build --release
Testing
# Run all tests
cargo test
# Run with property-based testing
cargo test --features quickcheck
Benchmarking
# Run benchmarks (requires benchmark feature)
cargo bench --features benchmark
License
Licensed under the MIT License. See LICENSE for details.
Dependencies
~3.5–6.5MB
~122K SLoC