A Rust implementation of the classic dealer.exe bridge hand generator, with full compatibility for dealer.exe and DealerV2_4 enhancements.
- dealer.exe Compatible: Exact RNG compatibility ensures same seed = same deals
- DealerV2_4 Enhancements: Command-line predeal switches, CSV export, title metadata
- Constraint Language: Full dealer.exe expression language with variables
- Multiple Output Formats: PBN, compact, one-line, and more
- Cross-Platform: Builds on Linux, macOS, and Windows
- Public Domain: Released under The Unlicense
cargo install --path dealerGenerate 10 deals where North has 15+ HCP:
echo "hcp(north) >= 15" | dealer -p 10Use a constraint file:
dealer -p 10 < constraints.dlPredeal specific cards (DealerV2_4 format):
echo "hcp(north) >= 0" | dealer -E S8743,HA9,D642,CQT64 -W SQ965,HK63,DAQJT,CA5 -p 5-p N, --produce N- Produce N matching deals (default: 40)-g N, --generate N- Generate N total deals (default: 1,000,000)-s N, --seed N- Random seed for reproducible results
-f FORMAT, --format FORMAT- Output format: printall, printew, printpbn, printcompact, printoneline-q, --quiet- Suppress deal output, only show statistics-v, --verbose- Show statistics at end
-N CARDS, --north CARDS- Predeal cards to North (e.g., SAKQ,HA)-E CARDS, --east CARDS- Predeal cards to East-S CARDS, --south CARDS- Predeal cards to South-W CARDS, --west CARDS- Predeal cards to West
-d POS, --dealer POS- Dealer position (N/E/S/W)--vulnerable VULN- Vulnerability (None/NS/EW/All)-T TEXT, --title TEXT- Title metadata for PBN output
-C FILE, --CSV FILE- CSV export file
-m, --progress- Show progress meter-V, --version- Show version information-h, --help- Show help message
dealer3 supports the full dealer.exe constraint language:
hcp(HAND)- High card pointsshape(HAND, S-H-D-C)- Exact shape (e.g., shape(north, 4432))spades(HAND),hearts(HAND),diamonds(HAND),clubs(HAND)- Suit lengthshascard(HAND, CARD)- Check for specific card
condition- Main constraint expressionaction- Output action (printall, printew, printpbn, etc.)produce N- Number of deals to producedealer POSITION- Dealer positionvulnerable TYPE- Vulnerabilitypredeal POSITION CARDS- Predeal cardsaverage EXPR- Calculate average over matching dealsfrequency EXPR- Generate frequency distribution
// Strong NT opening
opener = hcp(north) >= 15 and hcp(north) <= 17
balanced = shape(north, 4432) or shape(north, 4333) or shape(north, 5332)
condition opener and balanced
produce 20
action printpbn
dealer north
vulnerable none
- Rust 1.70 or later
- Cargo
# Clone the repository
git clone https://github.com/Rick-Wilson/Dealer3.git
cd Dealer3
# Build all crates
cargo build --release
# Run tests
cargo test --workspace
# Install
cargo install --path dealer./scripts/windows/build-windows.shSee docs/BUILDING_WINDOWS.md for details.
dealer3/
├── dealer/ - Main CLI binary
├── dealer-core/ - Deal generation and card logic
├── dealer-parser/ - Constraint language parser (PEG grammar)
├── dealer-eval/ - Expression evaluator
├── dealer-pbn/ - PBN format I/O
├── gnurandom/ - GNU/glibc random() RNG implementation
├── docs/ - Documentation
└── scripts/ - Build and utility scripts
✅ 100% RNG compatible - Same seed produces identical deals ✅ Full constraint language - All functions and operators supported ✅ Command-line switches - Core switches work identically
✅ Predeal switches - -N/-E/-S/-W for command-line predeal
✅ CSV export - -C for analytics output
✅ Title metadata - -T for PBN output
- CHANGELOG - Version history and breaking changes
- Filter Language Status - Feature implementation status
- Command-Line Switches - Switch compatibility
- Building for Windows - Cross-compilation guide
- Implementation Roadmap - Future features
Run the test suite:
cargo test --workspaceCompare output with dealer.exe:
# Generate test file
echo "hcp(north) >= 15" > test.dl
# Test dealer3
cat test.dl | ./target/release/dealer -s 1 -p 10 > dealer3.out
# Compare with dealer.exe (if available)
cat test.dl | dealer.exe -s 1 -p 10 > dealer.out
diff dealer3.out dealer.outdealer3 generates millions of deals per second with efficient constraint evaluation:
- Fast deal generation using optimized RNG
- Low memory footprint
- Efficient constraint evaluation
This project is released into the public domain under The Unlicense.
You are free to use, modify, distribute, and incorporate this software for any purpose, with or without modification, with no restrictions.
The original dealer.exe was also released into the public domain by Thomas Andrews.
- Original dealer.exe: Thomas Andrews (public domain)
- DealerV2_4: Thorvald Aagaard (GPLv3, independent implementation)
- dealer3: Rick Wilson (Unlicense)
Key contributors to dealer.exe ecosystem:
- Henk Uijterwaal, Bruce Moore, Francois Dellacherie, Robin Barker, Danil Suits, Alex Martelli, Paul Hankin, and many others
- GitHub: https://github.com/Rick-Wilson/Dealer3
- Original dealer.exe: http://www.bridgebase.com/tools/dealer/
- DealerV2_4: https://github.com/ed2k/dealer
For bugs, feature requests, or questions:
- Open an issue on GitHub: https://github.com/Rick-Wilson/Dealer3/issues
Note: This is an independent implementation. It is not affiliated with BridgeBase Online or the original dealer.exe project, though it maintains full compatibility with dealer.exe for script portability.