PokerFormationChecker 1.1.0

dotnet add package PokerFormationChecker --version 1.1.0
                    
NuGet\Install-Package PokerFormationChecker -Version 1.1.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="PokerFormationChecker" Version="1.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="PokerFormationChecker" Version="1.1.0" />
                    
Directory.Packages.props
<PackageReference Include="PokerFormationChecker" />
                    
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 PokerFormationChecker --version 1.1.0
                    
#r "nuget: PokerFormationChecker, 1.1.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=PokerFormationChecker&version=1.1.0
                    
Install PokerFormationChecker as a Cake Addin
#tool nuget:?package=PokerFormationChecker&version=1.1.0
                    
Install PokerFormationChecker as a Cake Tool

GenericPokerFormationChecker

A class that can identify poker hands, for .NET 8.0.

Testconsole

Install version 1.1.0 from NuGet:

Install-Package PokerFormationChecker

Example code:

Note that you must call the CheckFormation method before getting any formation information from the formation checker.

using System;
using Winsoft.Gaming.GenericPokerFormationChecker;

namespace ConsoleApplication1;

class Program
{
    static void Main(string[] args)
    {
        //Create a formation checker. Add five cards as string.
        var fm = new FormationChecker("HRT02, SPD03, HRT04, DMN05, CLB06"); //Input. Exception if string contains errors.

        //This will give true the formation is expressed correctly.
        fm.CheckFormation();

        //What is it?
        Console.WriteLine(fm.ToString()); //Output
    }
}

Input in example above:

HRT02, SPD03, HRT04, DMN05, CLB06

Output from example above:

FORMATION=STRAIGHT,SCORE=0420,HAND=HRT02*-SPD03*-HRT04*-DMN05*-CLB06*

Star (*) denotes that the card is included in a formation.

Sample input 2:

CLB06, SPD03, DMN07, DMN05, HRT06

Output from sample input 2:

FORMATION=PAIR,SCORE=0112,HAND=SPD03-DMN05-HRT06*-CLB06*-DMN07

Sample input 3:

SPD08, SPD09, DMN08, DMN09, CLB08

Output from sample input 3:

FORMATION=FULL-HOUSE,SCORE=0642,HAND=DMN08*-CLB08*-SPD08*-DMN09*-SPD09*

Sample input 3:

HRTAC, SPDAC, DMNAC, DMNKN, CLBAC

Output from sample input 3:

FORMATION=4-OF-A-KIND,SCORE=0756,HAND=DMNKN-HRTAC*-DMNAC*-CLBAC*-SPDAC*

Sample input 4:

HRTAC, SPDKN, DMN10, DMNKI, CLBQU

Output from sample input 4:

FORMATION=STRAIGHT,SCORE=0460,HAND=DMN10*-SPDKN*-CLBQU*-DMNKI*-HRTAC*

Sample input 5:

DMN02, DMNKN, CLBAC, HRT05, CLB09

Output from sample input 6:

FORMATION=NOTHING,SCORE=0014,HAND=DMN02-HRT05-CLB09-DMNKN-CLBAC*

Only one present star (*) denotes that no formation was found, and the hand score is equal to the score of the card with the highest score.

In version 1.0.5 or higher is the Hand class is self contained.

[Fact]
public void CanCheckFormations()
{
    var x = new Hand
    {
        { Suit.Clubs, Value.Value02 },
        { Suit.Hearts, Value.Value02 },
        { Suit.Spades, Value.Value02 },
        { Suit.Clubs, Value.Value03 },
        { Suit.Hearts, Value.Value03 }
    };

    Assert.Equal(612, x.Score);
    Assert.Equal(Formation.FullHouse, x.Formation);
}
Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  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.
  • net8.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.1.0 106 6/7/2025
1.0.6 469 1/7/2023
1.0.5 317 1/5/2023
1.0.4 326 12/19/2022
1.0.3 487 5/27/2022
1.0.2 537 2/10/2021
1.0.1 1,223 2/22/2017
1.0.0 1,242 12/16/2015

Moved to .NET 8.0.