ChessLibbyMrNaniii 1.0.7

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

ChessLib

A lightweight, headless C# chess engine. It handles board state management, move generation, and strict rule validation including castling, en passant, pawn promotion, and threefold repetition.

Installation

Install the library via NuGet:

dotnet add package ChessLibbyMrNaniii

Usage

The primary entry point for interacting with the engine is the GameManager class. Below is a quick guide on how to use the core features of the library.

Initialization and Basic Flow

using ChessLib.Core;
using ChessLib.Logic;
using ChessLib.Pieces;

// 1. Initialize a new game (sets up the standard starting position)
GameManager game = new GameManager();

// 2. Check the current turn
PieceColor turn = game.CurrentTurn; // Starts as PieceColor.White

// 3. Get all legal moves for a piece at a specific position (e.g., e2)
Position e2 = new Position(4, 6);
var legalMoves = game.GetLegalMoves(e2);

// 4. Make a move (e.g., e2 to e4)
Position e4 = new Position(4, 4);
bool isSuccess = game.MakeMove(e2, e4, out var promotionOptions);

Handling Pawn Promotion

If a pawn reaches the last rank, MakeMove will return a list of available pieces for promotion via the out parameter.

if (promotionOptions != null)
{
    // Apply the promotion choice (e.g., Queen)
    game.PromotePawn(targetPosition, PieceType.Queen);
}

Game State and Rules

The engine automatically tracks the history of the board to handle complex chess rules.

// Check if the current position has occurred 3 times (Draw)
bool isDraw = game.IsThreefoldRepetition();

Exporting Board Data

You can easily export the current state of the board to interact with external APIs, Python scripts, or UI frameworks.

// Returns a dictionary mapping algebraic coordinates to piece strings (e.g., "e2" -> "WhitePawn")
var boardState = game.Board.ExportBoardState();
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 (1)

Showing the top 1 NuGet packages that depend on ChessLibbyMrNaniii:

Package Downloads
ChessAIbyMrNaniii

Chess ai.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.7 147 5/20/2026
1.0.6 106 5/20/2026
1.0.5 108 5/5/2026
1.0.4 117 5/5/2026
1.0.3 113 5/5/2026
1.0.2 117 4/30/2026
1.0.1 135 4/7/2026
1.0.0 116 4/3/2026