Rudzoft.ChessLib 0.0.3

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

// Install Rudzoft.ChessLib as a Cake Tool
#tool nuget:?package=Rudzoft.ChessLib&version=0.0.3

ChessLib

A C# chess data library with complete move generation and all needed custom types.

Build status Build & Test Nuget

Requirements

  • .NET 6.0+

What is this for?

This library contains all the data, types and structures for which to create a piece of chess software. It does not contain any heuristics or search algorithms as these are meant to be implemented separately.

It also contains KPK bit compact data to determine endgame draw.

Can I use this as a starting point for my chess software?

Yes you can, it is designed with that in mind.

Features

  • Custom perft application which uses the library to calculate and compare results from custom positions
  • Transposition Table
  • Complete move generation with several types
    • Legal
    • Captures
    • Quiets
    • NonEvasions
    • Evasions
    • QuietChecks
  • Custom compact and very efficient types with tons of operators and helper functionality
    • Bitboard
    • CastleRight
    • Depth
    • Direction
    • ExtMove (move + score)
    • File
    • HashKey
    • Move
    • Piece
    • PieceSquare (for UI etc)
    • PieceValue
    • Player
    • Rank
    • Score
    • Square
    • Value
  • Bitboard use with piece attacks for all types, including lots of helper functions
  • Very fast FEN handling with optional legality check
  • Magic bitboard implementation Copyright (C) 2007 Pradyumna Kannan. Converted to C#
  • FEN input and output supported
  • Chess960 support
  • Zobrist key support
  • Basic UCI structure
  • HiRes timer
  • Draw by repetition detection
  • Mate validation
  • Notation generation
    • Coordinate
    • FAN
    • ICCF
    • LAN
    • RAN
    • SAN
    • SMITH
    • UCI
  • Benchmark project for perft
  • Custom MoveList data structure
  • Pawn blockage algorithm
  • Cuckoo repetition algorithm
  • Polyglot book support
  • Plenty of unit tests to see how it works

Perft

Perft console test program approximate timings to depth 6 for normal start position

  • AMD-FX 8350 = ~12.5 seconds. (without TT) (earlier version)
  • Intel i7-8086k = ~3.3 seconds

Transposition Table

ph

Move Generator

Example

// generate all legal moves for current position
const string fen = "rnbqkbnr/1ppQpppp/p2p4/8/8/2P5/PP1PPPPP/RNB1KBNR b KQkq - 1 6";

var game = GameFactory.Create(fen);
var moveList = game.Pos.GenerateMoves();
// ..

What is not included?

  • Evaluation (except KPK)
  • Search
  • Communication using e.i. UCI (base parameter struct supplied though)

Planned

  • Basic chess engine (search + evaluation) w. UCI support
Product 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. 
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
0.0.3 931 10/15/2022
0.0.2 754 9/3/2022