PokerEngine 0.1.8

dotnet add package PokerEngine --version 0.1.8
                    
NuGet\Install-Package PokerEngine -Version 0.1.8
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="PokerEngine" Version="0.1.8" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PokerEngine" Version="0.1.8" />
                    
Directory.Packages.props
<PackageReference Include="PokerEngine" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add PokerEngine --version 0.1.8
                    
#r "nuget: PokerEngine, 0.1.8"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package PokerEngine@0.1.8
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=PokerEngine&version=0.1.8
                    
Install as a Cake Addin
#tool nuget:?package=PokerEngine&version=0.1.8
                    
Install as a Cake Tool

<p align="center"> <img src="assets/pokerengine-logo_1.png" alt="PokerEngine" width="450"> </p>

<h1 align="center">PokerEngine</h1>

PokerEngine

PokerEngine is a deterministic poker rules engine written in C#.

Features

  • No-Limit Texas Hold'em
  • Manual and automatic dealing
  • Blinds, antes, straddles, and extra blinds
  • Betting validation
  • All-ins and side pots
  • Uncalled bet returns
  • Multiple boards and runouts
  • Hand evaluation
  • Event-based hand history
  • Real-hand replay tests

Status

The project is under active development. The public API may change before version 1.0.0.

Planned support:

  • Pot-Limit Omaha
  • Fixed-Limit games
  • NuGet distribution

Requirements

  • .NET 10 SDK

Build

dotnet restore
dotnet build
dotnet test

Manual mode

In manual mode, the caller posts blinds and deals cards.

using PokerEngine.Enums;
using PokerEngine.Games;
using PokerEngine.States;

IPokerGame game = new NoLimitTexasHoldem(
    automation: Automation.None,
    smallBlind: 100,
    bigBlind: 200);

IPokerState state = game.CreateState();

state.Initialize([10_000, 10_000, 10_000]);

state.PlayerPost(0, PostType.SmallBlind, 100);
state.PlayerPost(1, PostType.BigBlind, 200);

state.Start();

state.DealHole(0, ["As", "Ad"]);
state.DealHole(1, ["Kh", "Qh"]);
state.DealHole(2, ["7c", "7s"]);

// Preflop
state.PlayerAction(2, ActionType.RaiseTo, 600);
state.PlayerAction(0, ActionType.Call);
state.PlayerAction(1, ActionType.Call);

// Flop
state.DealBoard(0, ["2c", "7d", "Jh"]);

state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);

// Turn
state.DealBoard(0, ["Qs"]);

state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);

// River
state.DealBoard(0, ["9c"]);

state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);


//History
Console.WriteLine("*** HISTORY ***");
foreach (var e in state.Events)
{
    Console.WriteLine($"{e}");
}

Automatic mode

In automatic mode, the engine posts blinds, shuffles the deck, and deals cards.

Player decisions are still passed through PlayerAction.

using PokerEngine.Enums;
using PokerEngine.Games;
using PokerEngine.States;

IPokerGame game = new NoLimitTexasHoldem(
    automation: Automation.All,
    smallBlind: 100,
    bigBlind: 200);

IPokerState state = game.CreateState();

state.Initialize([10_000, 10_000, 10_000]);
state.Start();

// Preflop
state.PlayerAction(2, ActionType.RaiseTo, 600);
state.PlayerAction(0, ActionType.Call);
state.PlayerAction(1, ActionType.Call);

// Flop
state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);

// Turn
state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);

// River
state.PlayerAction(0, ActionType.Check);
state.PlayerAction(1, ActionType.Check);
state.PlayerAction(2, ActionType.Check);

//History
Console.WriteLine("*** HISTORY ***");
foreach (var e in state.Events)
{
    Console.WriteLine($"{e}");
}

Events

All state changes and hand results are stored in state.Events.

foreach (PokerHandEvent handEvent in state.Events)
{
    Console.WriteLine(handEvent);
}

For example, pot winners can be read from PotAwardedEvent:

foreach (PotAwardedEvent award in state.Events
             .OfType<PotAwardedEvent>())
{
    Console.WriteLine(
        $"Seat {award.SeatId} won {award.Amount} chips.");
}

A completed hand emits EndHandEvent.

Card format

Cards use two-character notation:

As = ace of spades
Kd = king of diamonds
Th = ten of hearts
2c = two of clubs

Hand evaluation

PokerEngine includes a Texas Hold'em hand evaluator that selects the strongest five-card combination from the player's hole cards and the board.

using PokerEngine.Evaluation;

IHandEvaluator evaluator = new TexasHoldemEvaluator();

HandRank result = evaluator.Evaluate(
    holeCards: ["As", "Ks"],
    boardCards: ["Qs", "Js", "Ts", "2d", "3c"]);

Console.WriteLine(result.Category);
Console.WriteLine(result.Strength);
Console.WriteLine(string.Join(", ", result.Cards));

License

This project is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net10.0 is compatible.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net10.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
0.1.8 112 8/3/2026
0.1.7 100 8/3/2026
0.1.6 102 8/3/2026
0.1.5 106 8/2/2026
0.1.4 98 8/2/2026
0.1.3 103 8/2/2026
0.1.2 103 8/2/2026
0.1.1 104 8/2/2026
0.1.0 100 8/2/2026