Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mikea/bridgitte
Contract Bridge Double Dummy Solver
https://github.com/mikea/bridgitte
bridge contract-bridge double-dummy solver
Last synced: 27 days ago
JSON representation
Contract Bridge Double Dummy Solver
- Host: GitHub
- URL: https://github.com/mikea/bridgitte
- Owner: mikea
- License: gpl-3.0
- Created: 2024-10-13T14:01:20.000Z (3 months ago)
- Default Branch: master
- Last Pushed: 2024-11-28T16:27:21.000Z (about 1 month ago)
- Last Synced: 2024-11-28T17:28:48.761Z (about 1 month ago)
- Topics: bridge, contract-bridge, double-dummy, solver
- Language: Rust
- Homepage:
- Size: 60.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Bridgitte
Bridgitte is a contract bridge double dummy solver written in Rust.
It was written for (personal) education to explore representing
card sets as 64-bit masks.## Installation
```
cargo +nightly install bridgitte
```## Usage
You can use bridgitte to fully analyze the deal:
```
$ bridgitte analyze-deal "854.Q873.Q984.65 KQ32.T6.T72.AJ93 9.AJ542.J653.T87 AJT76.K9.AK.KQ42"
♠ KQ32
♥ T6
♦ T72
♣ AJ93
♠ 854 ♠ 9
♥ Q873 ♥ AJ542
♦ Q984 ♦ J653
♣ 65 ♣ T87
♠ AJT76
♥ K9
♦ AK
♣ KQ42♣ ♦ ♥ ♠ N
W 1 6 7 1 1
N 12 6 6 12 12
E 1 6 7 1 1
S 12 6 6 12 12
```When limited to a declarer+strain bridgitte will give a winning play:
```
$ bridgitte analyze-deal --declarer N --strain S '854.Q873.Q984.65 KQ32.T6.T72.AJ93 9.AJ542.J653.T87 AJT76.K9.AK.KQ42'`
♠ KQ32
♥ T6
♦ T72
♣ AJ93
♠ 854 ♠ 9
♥ Q873 ♥ AJ542
♦ Q984 ♦ J653
♣ 65 ♣ T87
♠ AJT76
♥ K9
♦ AK
♣ KQ42♠
N 12W N E S
1 E 🂨 🂭 🂩 🂡
2 S 🂤 🂮 🂱 🂦
3 N 🂥 🂢 🂻 🂧
4 S 🂷 🂣 🂴 🂪
5 S 🂸 🂺 🂵 🂫
6 S 🂳 🂶 🂲 🂾
7 S 🂽 🃊 🃋 🂹
8 W 🃈 🃇 🃅 🃎
9 S 🃉 🃂 🃆 🃁
10 S 🃕 🃑 🃚 🃝
11 N 🃖 🃙 🃗 🃞
12 S 🃄 🃛 🃘 🃔
13 N 🃍 🃓 🃃 🃒
```## Design Notes
### Data Structures
- Card, Suit, CardValue are mainly used for IO operations
- CardSet is the main data structure used
in search. Set of cards represented as a single u64.
- Deal - simd optimized group of 4 card sets.
- PlayState represents the search node.### Search
Search algorithm is straightforward Zero-Window Partitioned Search.
Important details:
- NS is always a declaring pair.
- Trumps (if any) are always Spades.
- All cards are promoted after every trick
- Cards are not removed from the deck until the full trick is played.## Performance
As of Nov 2024 bridgitte is ~100 time slower than state of the art.
It takes seconds to evaluate "fast" positions and minutes for
"slow" ones.The following algorithm improvements will probably speed things up:
- quick tricks is applied only at the beginning of the round
- transposition table lookup is linear
- there's no move ordering## Code Contributions
Contributions are welcome. Just open a PR.