feat: add AlgorithmicEvaluator, migrate to log crate, fix flush value calculation

- Add AlgorithmicEvaluator wrapper for direct hand evaluation without
  lookup tables, with proper Result-based error handling
- Replace all println! and #[cfg(debug_assertions)] debug output with
  log crate macros (log::info!, log::debug!, log::warn!)
- Fix calculate_flush_value to use base-13 encoding for unique flush
  hand values instead of simple linear sum
- Fix is_straight to use cleaner control flow for regular and wheel
  straight detection
- Remove jump table HighCard/value=0 guard in evaluate_5_card to
  simplify evaluation path
- Add evaluate_n_card_hand_public as pub(crate) for AlgorithmicEvaluator
- Add .gitignore to exclude target/ and .idea/ from version control
- Add comprehensive tests for AlgorithmicEvaluator (14 test cases)
- Update README with new API usage examples
- Add log dependency to Cargo.toml
- Add placeholder modules for future implementations (tables_new,
  benchmark_utils, integration_utils, test_utils)
This commit is contained in:
Jan-Peter von Hunnius 2026-05-11 20:22:32 +02:00
parent 51e1f58ef9
commit dd605e8a66
16 changed files with 1666 additions and 228 deletions

View file

@ -1,7 +1,7 @@
# Poker Testbed - Java-Compatible Hand Evaluator for Bot Testing
[![Crates.io](https://img.shields.io/crates/v/poker-api.svg)](https://crates.io/crates/poker-api)
[![Documentation](https://docs.rs/poker-api/badge.svg)](https://docs.rs/poker-api)
[![Crates.io](https://img.shields.io/crates/v/holdem_core.svg)](https://crates.io/crates/holdem_core)
[![Documentation](https://docs.rs/holdem_core/badge.svg)](https://docs.rs/holdem_core)
[![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
A comprehensive poker bot testing framework with Java-compatible hand evaluation. This library implements the Meerkat API algorithm with full Java compatibility, specifically designed for automated poker bot testing, development, and integration with existing poker tools.
@ -50,31 +50,39 @@ Add this to your `Cargo.toml`:
```toml
[dependencies]
poker-api = "0.1.0"
holdem_core = "0.1.0"
```
## Quick Start - Bot Testing
```rust
use holdem_core::hand_evaluator::LookupHandEvaluator;
use holdem_core::api::{hand::Hand, card::Card};
use holdem_core::{Card, Hand, HoleCards, Board, Evaluator};
use std::str::FromStr;
// Initialize Java-compatible evaluator for bot testing
let evaluator = LookupHandEvaluator::new().unwrap();
// Create cards from string notation
let ace_spades = Card::from_str("As").unwrap();
let king_spades = Card::from_str("Ks").unwrap();
// Create hole cards for bot analysis
let mut hole_cards = Hand::new();
hole_cards.add_card(Card::from_string("As").unwrap()).unwrap();
hole_cards.add_card(Card::from_string("Ks").unwrap()).unwrap();
// Create hole cards from notation
let hole_cards = HoleCards::from_notation("AKs").unwrap();
// Evaluate hand strength for bot decision making
let rank = evaluator.rank_hand(&hole_cards);
println!("Hole card rank: {}", rank); // Lower = stronger hand
// Create a board with community cards
let board = Board::new()
.with_flop([
Card::from_str("Qh").unwrap(),
Card::from_str("Jh").unwrap(),
Card::from_str("Th").unwrap(),
]).unwrap()
.with_turn(Card::from_str("2c").unwrap()).unwrap()
.with_river(Card::from_str("3d").unwrap()).unwrap();
// Use rank for bot strategy decisions
if rank < 1000 { // Strong hand threshold
println!("Bot: This is a premium starting hand!");
}
// Create a hand from hole cards and board
let hand = Hand::from_hole_cards_and_board(&hole_cards, &board).unwrap();
// Evaluate the hand
let evaluator = Evaluator::new().unwrap();
let hand_value = evaluator.evaluate_hand(&hand);
println!("Hand rank: {:?}", hand_value.rank);
```
## Bot Testing Capabilities