Skip to content

Ark223/ACE

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

logo

ACE

Adaptive Cardplay Engine

Overview

ACE is a modern, open-source C# library dedicated to the cardplay phase of the game of Bridge, which is a classic example of an imperfect information game - games in which players make decisions without full knowledge of the game state and where chance influences the outcome - such games remain a persistent challenge in the field of AI.

One common approach in this domain, especially in card games, is to evaluate many sampled deals separately and pick the move that scores highest. However, this leads to strategy fusion - a flaw where decisions optimized for each sample fail to form a consistent plan across indistinguishable scenarios, often failing to generalize to real-world play.

ACE mitigates this problem using concepts from the following paper: https://ieeexplore.ieee.org/document/6203567. Instead of relying on shallow evaluation of sampled worlds, ACE applies a Monte Carlo tree search to explore deeper lines of play, reducing overconfident decisions, limiting bias, and producing more robust and human-like outcomes.

Features

ACE is still in an experimental stage, but already covers most practical use cases:

  • Support for any deal – Analyzes games with any mix of known and unknown cards.
  • High-performance core – Uses low-level bitwise operations for fast game processing.
  • Fast deal generator – Quickly produces random deals for simulation and decision making.
  • Hand constraint system – Filters deals by HCP and suit lengths (more constraints coming soon).
  • Smart solving algorithm – Based on research that avoids early commitment and strategy fusion.
  • Low memory consumption – Uses a compact, efficient tree structure with minimal allocations.
  • Multithreading – Runs simulations in parallel to accelerate large-scale analysis and sampling.
  • Backend-ready architecture – Easily integrates with tools, bots, UIs, or research pipelines.
  • Runs on .NET Standard 2.0 – Cross-platform support for Windows and Linux (x64).

History

Before starting ACE, I developed a separate project called BGA (Bridge Gameplay Analysis) – a desktop application with a graphical interface focused on analyzing cardplay using a pure PIMC-style algorithm with several domain-specific improvements. BGA supported only declarer play and produced convincing results across many test cases.

The project was described in my BSc thesis titled "Desktop application for the analysis of gameplay in the card game of Bridge", defended in March 2023 at the university Politechnika Bydgoska im. Jana i Jędrzeja Śniadeckich in Poland.

In fact, as noted in the thesis paper, BGA was able to solve more Bridge puzzles than a human expert under the same conditions – demonstrating the practical strength of the approach. However, BGA relied on heuristics, which in some edge cases led to suboptimal decisions when evaluation failed to capture the true complexity of the position.

ACE is a completely new project, built from the ground up as a high-performance backend library with a different architecture and philosophy. While it draws on insights gained from developing BGA, it introduces robust solving methods, supports both declarer and defender perspectives, and focuses on reducing strategy fusion.

Installation

You can use ACE in two main ways:

  • As a library (DLL), integrated into your own .NET projects
  • As a standalone console application, for direct interactive use

DLL Library

You can use ACE's library by adding the source code directly to your project or by compiling it as a local DLL.
The project is built in a Visual Studio environment and can be run from source using the included launcher.

Requirements:

  • Target framework: .NET Standard 2.0 or higher
  • Windows or Linux operating system (x64 architecture)
  • Native solver libbcalcdds must be available at runtime

Once installed or built, you can reference the compiled DLL in your .NET project like any standard library.
This is currently the only way to use it - a NuGet package is not available yet, but planned for future release.
Make sure to also include the native solver dependency, which is required at runtime to perform simulations.

You can find platform-specific versions in the runtimes folder:

  • runtimes/win-x64/native/libbcalcdds.dll for Windows x64
  • runtimes/linux-x64/native/libbcalcdds.so for Linux x64

For detailed usage instructions, refer to the lib folder in the repository.

Console Application

A standalone console application is included in the app folder, allowing you to use ACE without writing code.
Designed for ease of use, the application provides direct access to ACE core through a command-line interface.
To view available commands, simply compile and launch the app, then type help command at any prompt.

License

This project is open-source and licensed under the GPL-3.0 license.
See the LICENSE file for details.