Sandberg.Chess.ELO 1.0.1

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

// Install Sandberg.Chess.ELO as a Cake Tool
#tool nuget:?package=Sandberg.Chess.ELO&version=1.0.1

Sandberg.Chess.ELO

Easy to use library to calculate Chess ELO rating and ELO performance

Calculate ELO rating

RatingResult Sandberg.Chess.ELO.CalculateNewRating(double, double, GameResult, int?, int?);
# Example

double playerWhite = 1298; // Set white player rating
double playerBlack = 1485; // Set black player rating
var result = Sandberg.Chess.ELO.GameResult.White; // White/Remis/Black
var ratingResult = Sandberg.Chess.ELO.CalculateNewRating(playerWhite, playerBlack, result);

You can set kFactor for both white player and black player. Default is 20 for both.

CalculateNewRating will return a Sandberg.Chess.ELO.RatingResult object:

{
  "Winner": 1,
  "White": {
    "KFactor": 20,
    "ExpectedScore": 0.6400649998028851,
    "Score": 1,
    "OldRating": 1300,
    "NewRating": 1307.1987000039423,
    "RatingAdjustment": 7.198700003942349
  },
  "Black": {
    "KFactor": 20,
    "ExpectedScore": 0.35993500019711494,
    "Score": 0,
    "OldRating": 1200,
    "NewRating": 1192.8012999960577,
    "RatingAdjustment": -7.198700003942349
  }
}

Calculate performance rating

Performance rating is a hypothetical rating that would result from the games of a single event only. According to this algorithm, performance rating for an event is calculated in the following way:

  • For each win, add your opponent's rating plus 400 (factor),
  • For each remis, add your opponent's rating
  • For each loss, add your opponent's rating minus 400 (factor),
  • And divide this sum by the number of played games.

(You can use a different factor you like, but 400 is default)

double Sandberg.Chess.ELO.RatingPerformance(double[], double[], double[], int?);
double[] wins = [1200, 1300, 1100, 1600];
double[] remis = [1245, 1300];
double[] losses = [1500];

var performance = Sandberg.Chess.ELO.RatingPerformance(wins, remis, losses);
// performance rating --> 1492,142857142857
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • .NETStandard 2.0

    • No dependencies.
  • .NETStandard 2.1

    • 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.1 102 2/7/2024
1.0.0 82 2/1/2024