0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Build an object that represents a chess tournament then get it to calculate ratings of all the players.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
~> 10.4
~> 4.2
~> 3.2
 Project Readme

New Home¶ ↑

This repository was forked in late 2015 and is now maintained at github.com/ninkibah/icu_ratings.

ICU Chess Ratings¶ ↑

For calculating the Elo ratings of players in a chess tournament. The software is a port the Irish Chess Union’s existing rating software written in Microsoft Visual Basic and intended to replace it in the near future.

The rating calculations are the same as FIDE’s for tournaments that consist entirely of established players with the exception of player bonuses (which can be turned off) and different rules for assigning K-factors. However, the ICU has it’s own peculiar way of dealing with unrated players (players with only a provisional rating or without any prior rating) which is different to FIDE’s.

Install¶ ↑

sudo gem install icu_ratings

Tested on Ruby 1.9.2, 1.9.3, 2.2.0 and 2.2.0. Version 1.0.5 was the last to support Ruby 1.8.7.

Usage¶ ↑

First, create a new ICU::RatedTournament object:

t = ICU::RatedTournament.new(:desc => "Irish Championships 2008")

Then add players (see ICU::RatedPlayer for details):

t.add_player(1, :rating => 2534, :desc => 'Alexander Baburin (7085)', :kfactor => 16)
t.add_player(2, :rating => 2525, :desc => 'Alon Greenfeld')  # foreign (non-ICU) rated player
t.add_player(8, :rating => 2084, :desc => 'Anthony Fox (456)', :kfactor => 24)
# ...

Then add results (see ICU::RatedResult for details):

t.add_result(1, 1, 8, 'W')    # players 1 and 8 played in round 1, player 1 won
t.add_result(4, 2, 1, 'D')    # players 1 and 2 drew in round 4
# ...

Then call the rate! method using the recommended version of the algorithm (see ICU::RatedTournament).

t.rate!(version: 2)

If no exceptions have been raised yet, the tournament is now rated and the main results of the rating calculations can be extracted by querying the previously created player objects:

(1..32).each do |num|
  player = t.player(num)
  puts "Name: #{t.desc}"
  puts "Score: #{p.score}/#{p.results.size}"
  puts "New Rating: #{p.new_rating.round}"
  puts "Performance Rating: #{p.performance.round}"
end

# Name: Alexander Baburin (7085)
# Score: 8.0/9
# New Rating: 2558
# Performance Rating: 2607
# ...

See ICU::RatedPlayer for further details. Further breakdown of the rating calculations are available, if desired, from the results belonging to each player. See ICU::RatedResult for more details.

Author¶ ↑

Mark Orr, Irish Chess Union (ICU) rating officer.