1 unstable release
Uses new Rust 2024
| 0.1.0 | Oct 26, 2025 |
|---|
#2310 in Database interfaces
116 downloads per month
Used in openpql-runner
29KB
852 lines
Open PQL (Poker Query Language)
⚠️ Work in Progress: This project is currently under active development and is not yet ready for production use.
🌐 Try it online: An interactive demo is available at https://pql-playground.solve.poker/
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.
Overview
Open PQL provides a powerful query language for poker analysis, allowing users to perform complex calculations on poker scenarios using familiar SQL-like syntax. The library supports various poker variants and offers comprehensive hand evaluation, equity calculations, and range analysis capabilities.
Features
- Comprehensive Poker Library: Full-featured poker card and hand evaluation system
- SQL-like Query Language: Intuitive PQL syntax for poker analysis
- High Performance: Optimized Rust implementation for fast calculations
- Multi-game Support: Texas Hold'em and other poker variants
- Range Analysis: Advanced hand range evaluation and filtering
- Equity Calculations: Precise equity computations for different scenarios
Quick Start
Installation
Add Open PQL to your Cargo.toml:
[dependencies]
open-pql = "0.0.3"
CLI Usage
The opql command-line tool provides direct access to PQL functionality:
# Calculate average board suit count
opql -c "select avg(boardsuitcount(river)) from hero='As9s', villain='*', board='2s3sJh', game='holdem'"
# Analyze equity in specific scenarios
opql -c "select equity from hero='AhKh', villain='QQ+', board='Ah9s2c', game='holdem'"
WebAssembly Demo
Try Open PQL in your browser with the WebAssembly demo:
# Install trunk (if not already installed)
cargo install trunk
# Run the WASM demo
trunk serve --config ./open-pql-wasm/Trunk.toml
# Open http://localhost:8080 in your browser
Library Usage (WIP)
use open_pql::*;
// Example: Basic poker hand evaluation
let hand = parse_hand("AsKs")?;
let board = parse_board("AhKh2c")?;
let equity = calculate_equity(&hand, &board)?;
Architecture
This workspace contains four main crates:
open-pql: Core library with poker logic and PQL implementationopen-pql-macro: Procedural macros for compile-time optimizationsopql: Command-line interface for interactive PQL queriesopen-pql-wasm: WebAssembly interface for browser-based PQL execution
Development
Building
# Build all workspace members
cargo build --workspace
# Build with optimizations
cargo build --workspace --release
Testing
# Run all tests
cargo test --workspace
# Run with coverage
./scripts/coverage.sh
Benchmarking
# Run benchmarks
cargo bench --features benchmark
Documentation
- API Documentation: docs.rs/open-pql
- PQL Guide & Tutorial: pql-docs.solve.poker
License
This project is licensed under the MIT License - see the LICENSE file for details.
Acknowledgments
Special thanks to the original Odds Oracle (propokertools.com) team for pioneering the PQL concept and providing inspiration for this Rust implementation.
Dependencies
~2.7–5.5MB
~98K SLoC