CasinoSuite.Poker 1.0.0

dotnet add package CasinoSuite.Poker --version 1.0.0                
NuGet\Install-Package CasinoSuite.Poker -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="CasinoSuite.Poker" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CasinoSuite.Poker --version 1.0.0                
#r "nuget: CasinoSuite.Poker, 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.
// Install CasinoSuite.Poker as a Cake Addin
#addin nuget:?package=CasinoSuite.Poker&version=1.0.0

// Install CasinoSuite.Poker as a Cake Tool
#tool nuget:?package=CasinoSuite.Poker&version=1.0.0                

CasinoSuite.Poker

Nuget

Table of Contents

About

CasinoSuite.Poker is a comprehensive library for working with poker hands and cards in C#. This library includes classes for representing poker hands, cards, and offers utility methods for evaluating and comparing poker hands. It's a valuable tool for developers building poker-related applications, games, or simulations.

Features

This package includes the PokerHand.cs class. Using this class, you can

  • Determine the best hand possible given a collection of cards with PokerHand.getBestHand().
  • Determine if a certain hand wins against another hand with pokerHand.winsAgainst().
  • Determine the best hand from a list of hands iwht PokerHand.getWinningHand().

These tools should give you everything you need to create your own poker implementation, whether that's Texas Hold 'em, Omaha, or any of the beat the house variations.

Installation

To use this package in your project, you can install it via NuGet Package Manager:

nuget install CasinoSuite.Poker

Dependencies

Before using the CasinoSuite.Poker library, you should ensure that you have the following dependencies installed:

Nuget

DeckOfPlayingCards: This library provides the Deck and Card classes for managing decks of cards and individual cards. You can install it via NuGet using the following command:

nuget install DeckOfPlayingCards

Without this library you will not be able to create and evaluate PokerHands.

Usage

The code snippet below will demonstrate how to get a deck, draw some cards, create two hands, and determine which hand wins.

using PokerLibrary;
using DeckOfCardsLibrary;

// Get a new deck and shuffle it.
var deck = Deck.get();
deck.shuffle();

// Deal two cards to each player.
var cardsPlayerOne = new List<Card>();
cardsPlayerOne.Add(deck.draw());
cardsPlayerOne.Add(deck.draw());

var cardsPlayerTwo = new List<Card>();
cardsPlayerTwo.Add(deck.draw());
cardsPlayerTwo.Add(deck.draw());

// Deal the cards on the table;
var tableCards = new List<Card>();
tableCards.Add(deck.draw());
tableCards.Add(deck.draw());
tableCards.Add(deck.draw());
tableCards.Add(deck.draw());
tableCards.Add(deck.draw());

// Determine the strength of each hand.
var handPlayerOne = PokerHand.getBestHand(cardsPlayerOne.Union(tableCards));
var handPlayerTwo = PokerHand.getBestHand(cardsPlayerTwo.Union(tableCards));

// Get the winner.
var playerOneWins = handPlayerOne.winsAgainst(handPlayerTwo);

// Display the winner.
if (playerOneWins == true) {
	Console.WriteLine("Player 1 wins!");
}
else if (playerOneWins == false) {
	Console.WriteLine("Player 2 wins!");
}
else {
	Console.WriteLine("It's a draw!");
}

The GitHub repo also includes a console app which you can play around with.

Contributing and Feedback

If you have questions, concerns, or would like to contribute to this project, there are several ways to get involved:

  • Open an Issue: If you encounter a bug, have a feature request, or want to discuss improvements, please open an issue.

  • Start a Discussion: You can also initiate a discussion in the Discussions section of this repository to share ideas or seek help.

  • Fork and Contribute: If you'd like to make changes or enhancements to the project, fork the repository and submit a pull request with your proposed changes.

Your contributions and feedback are highly valued and essential to the improvement of this project. Thank you for your support!

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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 291 10/15/2023

First iteration, see README.md