PokerAlgo 1.0.0
dotnet add package PokerAlgo --version 1.0.0
NuGet\Install-Package PokerAlgo -Version 1.0.0
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="PokerAlgo" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PokerAlgo" Version="1.0.0" />
<PackageReference Include="PokerAlgo" />
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 PokerAlgo --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: PokerAlgo, 1.0.0"
#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.
#addin nuget:?package=PokerAlgo&version=1.0.0
#tool nuget:?package=PokerAlgo&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
🍑 PokerAlgo - Texas Hold 'em hand evaluator and simulation engine.
PokerAlgo is a C# library for evaluating poker hands, determining winners, and simulating win probabilities in Texas Hold 'em.
Features
- Determines the "winning hand" of a given Player.
- Determines the winner or winners in case of a tie.
- Given a winning hand, it will provide a "pretty" name. For example, "Full House, 7s over 5s" or "Pair of 7s".
- Provides the chances of winning or tying a round of Texas Hold 'em.
- Pre-flop, given a Player's hole cards, it can provide the chances of winning or tying using Monte Carlo simulations or using pre-computed data from a file.
- Post-flop, it can compute the chances of a player winning or tying using Monte Carlo simulations.
- Given a Player's hole cards, it can provide a hand strength value using Bill Chen's formula. A value ranging from -1 to 22.
Something to note about these predictions is that they are independent of other players. They are only calculated based on what a given player knows, hence why the chances don't add to 100%. The reason I added predictions is so I could build an AI that would make decisions based on its probabilities of winning.
- Monte Carlo Simulations are parallelized.
Future Improvements
- Simulate all players together for chances that add up to 100% on the board.
- Compute data tables for post-flop hands to avoid using simulations during a live game.
Compatibility
- .NET 6+
- Usable in any C# project
Installation
dotnet add package PokerAlgo
How to use
using PokerAlgo;
namespace PokerAlgoTest;
class Program
{
static void Main()
{
Deck deck = new();
List<Player> players = new() // at least 2 players
{
new Player("Player 1", deck.NextCard(), deck.NextCard()),
new Player("Player 2", deck.NextCard(), deck.NextCard()),
new Player("Player 3", deck.NextCard(), deck.NextCard()),
new Player("Player 4", deck.NextCard(), deck.NextCard()),
new Player("Player 5", deck.NextCard(), deck.NextCard()),
};
List<Card> community = deck.NextCards(5);
Console.WriteLine("Players:");
foreach (var player in players)
{
Console.WriteLine(player);
}
Console.WriteLine("\nCommunity Cards:");
foreach (Card item in community)
{
Console.Write(item + " ");
}
Console.WriteLine();
Player player1 = players[0];
HandEvaluator evaluator = new();
WinningHand winningHand = evaluator.GetWinningHand(player1.HoleCards, community);
Console.WriteLine("\nPlayer 1 WinningHand: \n" + winningHand);
Console.WriteLine("\nChances of Player 1 Winning:");
var chances = ChanceCalculator.GetWinningChanceSimParallel(player1.HoleCards, community, players.Count - 1, 10_000);
Console.WriteLine($"Win: {chances.winChance}\nTie: {chances.tieChance}");
List<Player> winners = Algo.GetWinners(players, community);
Console.WriteLine();
Console.WriteLine(winners.Count == 1 ? "Winner:" : "Tie:");
foreach (Player winner in winners)
{
Console.WriteLine(winner);
Console.WriteLine(winner.WinningHand);
Console.WriteLine(Helpers.GetPrettyHandName(winner.WinningHand));
Console.WriteLine();
}
}
}
License
This project is licensed under the MIT License.
Licenses Used
- Package Icon based on "OpenMoji" – the open-source emoji set (https://openmoji.org), licensed under CC BY-SA 4.0.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. 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.
-
net6.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 |
---|---|---|
1.0.0 | 108 | 6/20/2025 |