elo_rating_system 1.0.0 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: '0909a55bfa03184b3749b7541ab13e04ec8fb18046e91f3ca4195dc0d754df52'
4
- data.tar.gz: e1e94e1e98ab97a7dfbd97711d3936a061d9118c24d8b27d3d2dc53ab2e67900
3
+ metadata.gz: a72869470138683daefb58ff0a50aa79b699aa3c6404f7dee24ea78d6b3de32b
4
+ data.tar.gz: b2405e2afa7b6674f89cb4f45b9c2066caac9bedfc7b527c91417cafd8abea79
5
5
  SHA512:
6
- metadata.gz: a45de5f13d7ca44c825e1ad33740a3b6959e305d12539a5c275892b29ef08807aa501c67644358ad432d8a583212cb5c5aee427565ba445f0ef044077db47f21
7
- data.tar.gz: ddb80c8f9a831471682ccea378da95bbb08c9c50e24e2f991047fab22c2020a85b9d6a297701487656b92c20fb3a1f2197e5eb7c0b5c2fce8157ee7843dfd309
6
+ metadata.gz: 445725a78830ca205ace8e5624ca753d16e66f78fdd63672defde951aadbfabe91d1816edbdd7fe83baadd49f9c3b2a506c1a6b4377b7ff9d7c110efcab72ab7
7
+ data.tar.gz: 3ac0958be391a4c91fa9c2f7ac391aa9561c8fa5e550f5d4a5d8d95160a3323e5a83a5af5fce74c7ffe63e11fd4b98b521d295347ae1edeaea6e4d2478c77ca5
data/LICENSE.md CHANGED
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Sashite
3
+ Copyright (c) 2018-2020 Sashite
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
data/README.md CHANGED
@@ -1,52 +1,175 @@
1
- # Elo rating system
1
+ # EloRatingSystem
2
2
 
3
- [![Inline docs](https://inch-ci.org/github/sashite/elo_rating_system.svg?branch=master)][inchpages]
3
+ [![Version](https://img.shields.io/github/v/tag/sashite/elo_rating_system.rb?label=Version&logo=github)](https://github.com/sashite/elo_rating_system.rb/tags)
4
+ [![Yard documentation](https://img.shields.io/badge/Yard-documentation-blue.svg?logo=github)](https://rubydoc.info/github/sashite/elo_rating_system.rb/main)
5
+ ![Ruby](https://github.com/sashite/elo_rating_system.rb/actions/workflows/ruby.yml/badge.svg?branch=main)
6
+ ![RuboCop](https://github.com/sashite/elo_rating_system.rb/actions/workflows/rubocop.yml/badge.svg?branch=main)
7
+ [![License](https://img.shields.io/github/license/sashite/elo_rating_system.rb?label=License&logo=github)](https://github.com/sashite/elo_rating_system.rb/raw/main/LICENSE.md)
4
8
 
5
- Very simple Ruby implementation of the Elo rating system, a method for calculating the relative skill levels of players in zero-sum games such as chess.
9
+ A lightweight, thread-safe Ruby implementation of the [Elo rating system](https://en.wikipedia.org/wiki/Elo_rating_system), a method for calculating the relative skill levels of players in two-player games such as chess.
6
10
 
7
- It contains two functions: `expected(player_a, player_b)`, to calculate the expected score of `player_a` in a match against `player_b`; and `elo(old, exp, score, k_factor = 32)`, to calculate the new score for each player.
11
+ It has two functions: `expected_score`, the score a player is expected to make against an opponent, and `rate`, the rating of a player after one or several games.
8
12
 
9
13
  ## Installation
10
14
 
11
- Add this line to your application's Gemfile:
15
+ ```ruby
16
+ gem "elo_rating_system", "~> 2.0"
17
+ ```
18
+
19
+ Ruby 3.3 or later is required.
20
+
21
+ Version 2 replaces `expected` and `elo` with `expected_score` and `rate`. See [Upgrading from 1.x](#upgrading-from-1x).
22
+
23
+ ## Usage
24
+
25
+ ### Expected score
26
+
27
+ `EloRatingSystem.expected_score` takes the rating of a player and the rating of an opponent. It returns the score the player is expected to make, between `0.0` and `1.0`:
12
28
 
13
29
  ```ruby
14
- gem 'elo_rating_system'
30
+ EloRatingSystem.expected_score(1613, 1609)
31
+ # => 0.5057562084111449
32
+
33
+ EloRatingSystem.expected_score(1613, 1720)
34
+ # => 0.3507050528890364
35
+
36
+ EloRatingSystem.expected_score(1500, 1500)
37
+ # => 0.5
15
38
  ```
16
39
 
17
- And then execute:
40
+ A score is `1` for a win, `0.5` for a draw and `0` for a loss, so the expected score is the probability of winning plus half the probability of drawing. The expected scores of two players against each other add up to `1`.
41
+
42
+ ### New rating
18
43
 
19
- $ bundle
44
+ `EloRatingSystem.rate` takes the rating of a player and the games of a rating period. Each game is a pair: the rating of the opponent, then the score of the player. It returns the new rating:
20
45
 
21
- Or install it yourself as:
46
+ ```ruby
47
+ EloRatingSystem.rate(1613, [[1609, 0]])
48
+ # => 1596.8158013308434 (a loss against a player rated 1609)
49
+ ```
22
50
 
23
- $ gem install elo_rating_system
51
+ The result is not rounded. Round it where your application needs to, for display or for storage:
52
+
53
+ ```ruby
54
+ EloRatingSystem.rate(1613, [[1609, 0]]).round
55
+ # => 1597
56
+ ```
24
57
 
25
- ## Example
58
+ ### Rating periods
26
59
 
27
- In a five-round tournament, player A, with a rating of `1613`, plays against opponents with the following ratings: `1609`, `1477`, `1388`, `1586`, `1720`.
60
+ A rating period can be a single game, a tournament, or any set of games you decide to rate at once. All its games are rated from the rating the player had before the period.
28
61
 
29
- The expected score is therefore:
62
+ In a five-round tournament, a player rated `1613` loses to a player rated `1609`, draws with a player rated `1477`, defeats players rated `1388` and `1586`, and loses to a player rated `1720`:
30
63
 
31
64
  ```ruby
32
- exp = EloRatingSystem.expected(1613, 1609)
33
- exp += EloRatingSystem.expected(1613, 1477)
34
- exp += EloRatingSystem.expected(1613, 1388)
35
- exp += EloRatingSystem.expected(1613, 1586)
36
- exp += EloRatingSystem.expected(1613, 1720)
65
+ tournament = [[1609, 0], [1477, 0.5], [1388, 1], [1586, 1], [1720, 0]]
37
66
 
38
- exp.round(3) # => 2.867
67
+ EloRatingSystem.rate(1613, tournament)
68
+ # => 1601.2698768627572
39
69
  ```
40
70
 
41
- Player A lost match #1, draw match #2, wins match #3 and #4, and loses match #5.
42
- Therefore the player's actual score is `(0 + 0.5 + 1 + 1 + 0) = 2.5`.
71
+ The player scored `2.5` points where `2.867` were expected, and loses `32 × (2.867 − 2.5)` points.
43
72
 
44
- We can now use this to calculate the new Elo rating for player A:
73
+ A rating period without any game leaves the rating where it is:
45
74
 
46
75
  ```ruby
47
- EloRatingSystem.elo(1613, 2.867, 2.5).round # => 1601
76
+ EloRatingSystem.rate(1613, [])
77
+ # => 1613.0
48
78
  ```
49
79
 
50
- ## Contributing
80
+ ### K-factor
81
+
82
+ The K-factor is the number of points a rating moves when a score differs from its expectation by one. It defaults to `32` (`EloRatingSystem::DEFAULT_K_FACTOR`), and the `k_factor` keyword sets another one:
83
+
84
+ ```ruby
85
+ EloRatingSystem.rate(2400, [[2500, 1]], k_factor: 10)
86
+ # => 2406.4006499980287
87
+ ```
88
+
89
+ Which K-factor to use, and for which players, is a decision of the organization that publishes the ratings. A higher one makes ratings follow recent results faster.
90
+
91
+ ### Scores
92
+
93
+ A score is any number from `0` to `1`. Besides a loss, a draw and a win, this makes room for graded outcomes, as long as the two scores of a game add up to `1`:
94
+
95
+ ```ruby
96
+ EloRatingSystem.rate(1500, [[1500, 0.75]])
97
+ # => 1508.0
98
+
99
+ EloRatingSystem.rate(1500, [[1500, 0.25]])
100
+ # => 1492.0
101
+ ```
102
+
103
+ When both players are rated with the same K-factor, one gains what the other loses.
104
+
105
+ ## Formulas
106
+
107
+ A player rated `R` who meets an opponent rated `Ro` is expected to score:
108
+
109
+ ```
110
+ E = 1 / (1 + 10^((Ro − R) / 400))
111
+ ```
112
+
113
+ After the games of a rating period, the rating becomes:
114
+
115
+ ```
116
+ R′ = R + K × (S − E)
117
+ ```
118
+
119
+ where `S` is the sum of the scores of the player, `E` the sum of their expected scores and `K` the K-factor.
120
+
121
+ The test suite compares the library with values that it did not produce: the results of these formulas carried out with 50 significant digits, and the example of the [Wikipedia article](https://en.wikipedia.org/wiki/Elo_rating_system).
122
+
123
+ ## Arguments
124
+
125
+ Ratings, scores and K-factors are Integers or Floats. Every argument is checked, so that an invalid value never reaches a rating:
126
+
127
+ | Error | Message | Cause |
128
+ |-------|---------|-------|
129
+ | `TypeError` | `Rating must be an Integer or a Float` | A rating of another class, such as a String or `nil` |
130
+ | `ArgumentError` | `Rating must be finite` | A rating that is NaN or infinite |
131
+ | `TypeError` | `Score must be an Integer or a Float` | A score of another class |
132
+ | `ArgumentError` | `Score must be between 0 and 1` | A score out of range, or NaN |
133
+ | `TypeError` | `K-factor must be an Integer or a Float` | A K-factor of another class |
134
+ | `ArgumentError` | `K-factor must be finite and not negative` | A negative, NaN or infinite K-factor |
135
+ | `TypeError` | `Game results must be an Array` | Game results of another class |
136
+ | `TypeError` | `Game result must be an Array of an opponent rating and a score` | A game result that is not a pair |
137
+
138
+ Numbers of other classes, such as Rationals, are not converted.
139
+
140
+ Every result is a Float, and follows the rules of Float arithmetic: for ratings far apart, the expected score reaches `0.0` or `1.0`.
141
+
142
+ The library has no dependencies, keeps no state, and is safe to call from any thread.
143
+
144
+ ## Upgrading from 1.x
145
+
146
+ | 1.x | 2.0 |
147
+ |-----|-----|
148
+ | `EloRatingSystem.expected(1613, 1609)` | `EloRatingSystem.expected_score(1613, 1609)` |
149
+ | `EloRatingSystem.elo(1613, expected, score)` | `EloRatingSystem.rate(1613, game_results)` |
150
+ | `EloRatingSystem.elo(1613, expected, score, 24)` | `EloRatingSystem.rate(1613, game_results, k_factor: 24)` |
151
+
152
+ `expected_score` returns what `expected` returned.
153
+
154
+ `elo` took the sum of the expected scores and the sum of the scores, which the caller had to compute. `rate` takes the games themselves and computes both sums:
155
+
156
+ ```ruby
157
+ # 1.x
158
+ expected = [1609, 1477, 1388, 1586, 1720].sum { |opponent_rating| EloRatingSystem.expected(1613, opponent_rating) }
159
+ EloRatingSystem.elo(1613, expected, 2.5)
160
+
161
+ # 2.0
162
+ EloRatingSystem.rate(1613, [[1609, 0], [1477, 0.5], [1388, 1], [1586, 1], [1720, 0]])
163
+ ```
164
+
165
+ Version 2 also checks its arguments: 1.x computed with whatever it was given, and returned NaN for a NaN.
166
+
167
+ ## License
168
+
169
+ The code is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
170
+
171
+ ## About Sashité
172
+
173
+ This [gem](https://rubygems.org/gems/elo_rating_system) is maintained by [Sashité](https://sashite.com/).
51
174
 
52
- Bug reports and pull requests are welcome on GitHub at https://github.com/sashite/elo_rating_system.
175
+ With some [lines of code](https://github.com/sashite/), let's share the beauty of Chinese, Japanese and Western cultures through the game of chess!
@@ -1,24 +1,190 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- # Elo rating system
3
+ # The Elo rating system for two-player games.
4
+ #
5
+ # {EloRatingSystem.expected_score} returns the score a player is expected to
6
+ # make against an opponent, and {EloRatingSystem.rate} returns the rating of
7
+ # a player after one or several games:
8
+ #
9
+ # EloRatingSystem.expected_score(1613, 1609)
10
+ # # => 0.5057562084111449
11
+ #
12
+ # EloRatingSystem.rate(1613, [[1609, 0]])
13
+ # # => 1596.8158013308434
14
+ #
15
+ # The library has no dependencies and keeps no state. It is safe to call from
16
+ # any thread.
17
+ #
18
+ # == Formulas
19
+ #
20
+ # A player rated +R+ who meets an opponent rated +Ro+ is expected to score:
21
+ #
22
+ # E = 1 / (1 + 10^((Ro - R) / 400))
23
+ #
24
+ # A score is +1+ for a win, +0.5+ for a draw and +0+ for a loss, so that the
25
+ # expected score is the probability of winning plus half the probability of
26
+ # drawing. After the games of a rating period, the rating becomes:
27
+ #
28
+ # R' = R + K * (S - E)
29
+ #
30
+ # where +S+ is the sum of the scores of the player, +E+ the sum of their
31
+ # expected scores and +K+ the K-factor: the number of points a rating moves
32
+ # when a score differs from its expectation by one.
33
+ #
34
+ # == Arguments
35
+ #
36
+ # Ratings, scores and K-factors are Integers or Floats, and every result is a
37
+ # Float. Other numbers, such as Rationals, are not converted. Every argument
38
+ # is checked: NaN, an infinite value, a score out of range or a negative
39
+ # K-factor raises an error, so that an invalid value never reaches a rating.
4
40
  #
5
41
  # @see https://en.wikipedia.org/wiki/Elo_rating_system
6
42
  module EloRatingSystem
7
- def self.expected(player_a, player_b)
8
- # @note Calculate expected score of A in a match against B.
43
+ # The K-factor {rate} uses when none is given.
44
+ DEFAULT_K_FACTOR = 32
45
+
46
+ # The rating difference that multiplies the odds of a player by {BASE}: a
47
+ # player rated 400 points above an opponent is expected to score ten times
48
+ # as much as the opponent.
49
+ SCALE = 400.0
50
+
51
+ # See {SCALE}.
52
+ BASE = 10.0
53
+
54
+ # The values a rating can take: every finite number.
55
+ RATINGS = -::Float::MAX..::Float::MAX
56
+
57
+ # The values a score can take, from a loss to a win.
58
+ SCORES = 0.0..1.0
59
+
60
+ # The values a K-factor can take: every finite number that is not negative.
61
+ K_FACTORS = 0.0..::Float::MAX
62
+
63
+ # Error message raised when a rating is neither an Integer nor a Float.
64
+ RATING_TYPE_ERROR = "Rating must be an Integer or a Float"
65
+
66
+ # Error message raised when a rating is NaN or infinite.
67
+ RATING_RANGE_ERROR = "Rating must be finite"
68
+
69
+ # Error message raised when a score is neither an Integer nor a Float.
70
+ SCORE_TYPE_ERROR = "Score must be an Integer or a Float"
71
+
72
+ # Error message raised when a score is not between a loss and a win.
73
+ SCORE_RANGE_ERROR = "Score must be between 0 and 1"
74
+
75
+ # Error message raised when a K-factor is neither an Integer nor a Float.
76
+ K_FACTOR_TYPE_ERROR = "K-factor must be an Integer or a Float"
77
+
78
+ # Error message raised when a K-factor is negative, NaN or infinite.
79
+ K_FACTOR_RANGE_ERROR = "K-factor must be finite and not negative"
80
+
81
+ # Error message raised when the game results are not an Array.
82
+ GAME_RESULTS_TYPE_ERROR = "Game results must be an Array"
83
+
84
+ # Error message raised when a game result is not a pair.
85
+ GAME_RESULT_TYPE_ERROR = "Game result must be an Array of an opponent rating and a score"
86
+
87
+ private_constant :SCALE, :BASE, :RATINGS, :SCORES, :K_FACTORS,
88
+ :RATING_TYPE_ERROR, :RATING_RANGE_ERROR,
89
+ :SCORE_TYPE_ERROR, :SCORE_RANGE_ERROR,
90
+ :K_FACTOR_TYPE_ERROR, :K_FACTOR_RANGE_ERROR,
91
+ :GAME_RESULTS_TYPE_ERROR, :GAME_RESULT_TYPE_ERROR
92
+
93
+ class << self
94
+ # Returns the score a player rated +rating+ is expected to make against
95
+ # an opponent rated +opponent_rating+.
9
96
  #
10
- # @param player_a [Integer] Elo rating for player a.
11
- # @param player_b [Integer] Elo rating for player b.
12
- 1 / (1 + 10**((player_b - player_a.to_f) / 400))
13
- end
97
+ # The expected scores of two players against each other add up to 1.
98
+ #
99
+ # @param rating [Integer, Float] the rating of the player
100
+ # @param opponent_rating [Integer, Float] the rating of the opponent
101
+ #
102
+ # @return [Float] the expected score, between 0.0 and 1.0
103
+ #
104
+ # @raise [TypeError] if a rating is neither an Integer nor a Float
105
+ # @raise [ArgumentError] if a rating is NaN or infinite
106
+ #
107
+ # @example Players of equal strength
108
+ # EloRatingSystem.expected_score(1500, 1500)
109
+ # # => 0.5
110
+ #
111
+ # @example A player rated 400 points above their opponent
112
+ # EloRatingSystem.expected_score(1900, 1500)
113
+ # # => 0.9090909090909091
114
+ def expected_score(rating, opponent_rating)
115
+ expectation(to_rating(rating), to_rating(opponent_rating))
116
+ end
14
117
 
15
- def self.elo(old, exp, score, k_factor = 32)
16
- # @note Calculate the new Elo rating for a player.
118
+ # Returns the rating of a player after a rating period, given the games
119
+ # they played in it.
120
+ #
121
+ # All the games of a rating period are rated at once, from the rating the
122
+ # player had before the period. A rating period can be a tournament, or a
123
+ # single game.
124
+ #
125
+ # @param rating [Integer, Float] the rating of the player before the
126
+ # rating period
127
+ # @param game_results [Array<Array<Integer, Float>>] the games of the
128
+ # rating period: for each one, the rating of the opponent and the score
129
+ # of the player, from 0 (loss) to 1 (win)
130
+ # @param k_factor [Integer, Float] the K-factor
131
+ #
132
+ # @return [Float] the new rating, which is not rounded
133
+ #
134
+ # @raise [TypeError] if +game_results+ is not an Array of pairs, or if a
135
+ # rating, a score or the K-factor is neither an Integer nor a Float
136
+ # @raise [ArgumentError] if a rating or the K-factor is NaN or infinite,
137
+ # if a score is not between 0 and 1, or if the K-factor is negative
17
138
  #
18
- # @param old [Integer] The previous Elo rating.
19
- # @param exp [Float] The expected score for this match.
20
- # @param score [Float] The actual score for this match.
21
- # @param k_factor [Integer] The k-factor for Elo (default: 32).
22
- old + k_factor * (score - exp)
139
+ # @example A tournament of five games
140
+ # EloRatingSystem.rate(1613, [[1609, 0], [1477, 0.5], [1388, 1], [1586, 1], [1720, 0]])
141
+ # # => 1601.2698768627572
142
+ #
143
+ # @example A single game, with another K-factor
144
+ # EloRatingSystem.rate(2400, [[2500, 1]], k_factor: 10)
145
+ # # => 2406.4006499980287
146
+ #
147
+ # @example A rating period without any game
148
+ # EloRatingSystem.rate(1613, [])
149
+ # # => 1613.0
150
+ def rate(rating, game_results, k_factor: DEFAULT_K_FACTOR)
151
+ raise ::TypeError, GAME_RESULTS_TYPE_ERROR unless game_results.is_a?(::Array)
152
+
153
+ rating = to_rating(rating)
154
+ k_factor = float(k_factor, K_FACTORS, K_FACTOR_TYPE_ERROR, K_FACTOR_RANGE_ERROR)
155
+
156
+ rating + (k_factor * game_results.sum(0.0) { |game_result| surplus(rating, game_result) })
157
+ end
158
+
159
+ private
160
+
161
+ # The score of a game, less the score that was expected.
162
+ def surplus(rating, game_result)
163
+ raise ::TypeError, GAME_RESULT_TYPE_ERROR unless game_result.is_a?(::Array) && game_result.size == 2
164
+
165
+ opponent_rating, score = game_result
166
+
167
+ float(score, SCORES, SCORE_TYPE_ERROR, SCORE_RANGE_ERROR) - expectation(rating, to_rating(opponent_rating))
168
+ end
169
+
170
+ # E = 1 / (1 + 10^((Ro - R) / 400))
171
+ def expectation(rating, opponent_rating)
172
+ 1.0 / (1.0 + (BASE**((opponent_rating - rating) / SCALE)))
173
+ end
174
+
175
+ # A rating as a Float, once checked.
176
+ def to_rating(value)
177
+ float(value, RATINGS, RATING_TYPE_ERROR, RATING_RANGE_ERROR)
178
+ end
179
+
180
+ # A number as a Float, once checked against the values it can take. The
181
+ # range is tested before the conversion: an Integer too large for a Float
182
+ # is out of every range.
183
+ def float(value, range, type_error, range_error)
184
+ raise ::TypeError, type_error unless value.is_a?(::Integer) || value.is_a?(::Float)
185
+ raise ::ArgumentError, range_error unless range.cover?(value)
186
+
187
+ value.to_f
188
+ end
23
189
  end
24
190
  end
metadata CHANGED
@@ -1,84 +1,36 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: elo_rating_system
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 2.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Cyril Kato
8
- autorequire:
9
- bindir: exe
8
+ autorequire:
9
+ bindir: bin
10
10
  cert_chain: []
11
- date: 2018-08-16 00:00:00.000000000 Z
12
- dependencies:
13
- - !ruby/object:Gem::Dependency
14
- name: bundler
15
- requirement: !ruby/object:Gem::Requirement
16
- requirements:
17
- - - "~>"
18
- - !ruby/object:Gem::Version
19
- version: '1.16'
20
- type: :development
21
- prerelease: false
22
- version_requirements: !ruby/object:Gem::Requirement
23
- requirements:
24
- - - "~>"
25
- - !ruby/object:Gem::Version
26
- version: '1.16'
27
- - !ruby/object:Gem::Dependency
28
- name: fix
29
- requirement: !ruby/object:Gem::Requirement
30
- requirements:
31
- - - "~>"
32
- - !ruby/object:Gem::Version
33
- version: '0.17'
34
- type: :development
35
- prerelease: false
36
- version_requirements: !ruby/object:Gem::Requirement
37
- requirements:
38
- - - "~>"
39
- - !ruby/object:Gem::Version
40
- version: '0.17'
41
- - !ruby/object:Gem::Dependency
42
- name: rake
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - "~>"
46
- - !ruby/object:Gem::Version
47
- version: '12.3'
48
- type: :development
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - "~>"
53
- - !ruby/object:Gem::Version
54
- version: '12.3'
55
- description: A method for calculating the relative skill levels of players in zero-sum
56
- games such as chess.
57
- email:
58
- - contact@cyril.email
11
+ date: 2026-12-04 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description: A lightweight, thread-safe Ruby implementation of the Elo rating system,
14
+ a method for calculating the relative skill levels of players in two-player games
15
+ such as chess.
16
+ email: contact@cyril.email
59
17
  executables: []
60
18
  extensions: []
61
19
  extra_rdoc_files: []
62
20
  files:
63
- - ".gitignore"
64
- - ".rspec"
65
- - ".ruby-version"
66
- - ".travis.yml"
67
- - Gemfile
68
- - Gemfile.lock
69
21
  - LICENSE.md
70
22
  - README.md
71
- - Rakefile
72
- - VERSION.semver
73
- - bin/console
74
- - bin/setup
75
- - elo_rating_system.gemspec
76
23
  - lib/elo_rating_system.rb
77
- homepage: https://github.com/sashite/elo_rating_system
24
+ homepage: https://github.com/sashite/elo_rating_system.rb
78
25
  licenses:
79
26
  - MIT
80
- metadata: {}
81
- post_install_message:
27
+ metadata:
28
+ rubygems_mfa_required: 'true'
29
+ source_code_uri: https://github.com/sashite/elo_rating_system.rb
30
+ documentation_uri: https://rubydoc.info/github/sashite/elo_rating_system.rb/main
31
+ bug_tracker_uri: https://github.com/sashite/elo_rating_system.rb/issues
32
+ changelog_uri: https://github.com/sashite/elo_rating_system.rb/blob/main/CHANGELOG.md
33
+ post_install_message:
82
34
  rdoc_options: []
83
35
  require_paths:
84
36
  - lib
@@ -86,16 +38,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
86
38
  requirements:
87
39
  - - ">="
88
40
  - !ruby/object:Gem::Version
89
- version: '0'
41
+ version: 3.3.0
90
42
  required_rubygems_version: !ruby/object:Gem::Requirement
91
43
  requirements:
92
44
  - - ">="
93
45
  - !ruby/object:Gem::Version
94
46
  version: '0'
95
47
  requirements: []
96
- rubyforge_project:
97
- rubygems_version: 2.7.3
98
- signing_key:
48
+ rubygems_version: 3.5.22
49
+ signing_key:
99
50
  specification_version: 4
100
51
  summary: Elo rating system
101
52
  test_files: []
data/.gitignore DELETED
@@ -1,11 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /_yardoc/
4
- /coverage/
5
- /doc/
6
- /pkg/
7
- /spec/reports/
8
- /tmp/
9
-
10
- # rspec failure tracking
11
- .rspec_status
data/.rspec DELETED
@@ -1,3 +0,0 @@
1
- --format documentation
2
- --color
3
- --require spec_helper
data/.ruby-version DELETED
@@ -1 +0,0 @@
1
- 2.5.0
data/.travis.yml DELETED
@@ -1,5 +0,0 @@
1
- sudo: false
2
- language: ruby
3
- rvm:
4
- - 2.5.0
5
- before_install: gem install bundler -v 1.16.1
data/Gemfile DELETED
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- source 'https://rubygems.org'
4
-
5
- gemspec
data/Gemfile.lock DELETED
@@ -1,32 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- elo_rating_system (1.0.0)
5
-
6
- GEM
7
- remote: https://rubygems.org/
8
- specs:
9
- aw (0.1.1)
10
- defi (1.1.3)
11
- fix (0.17.1)
12
- aw (~> 0.1.1)
13
- defi (~> 1.1.3)
14
- spectus (~> 3.0.6)
15
- matchi (1.0.2)
16
- rake (12.3.1)
17
- spectus (3.0.6)
18
- aw (~> 0.1.1)
19
- defi (~> 1.1.1)
20
- matchi (~> 1.0.2)
21
-
22
- PLATFORMS
23
- ruby
24
-
25
- DEPENDENCIES
26
- bundler (~> 1.16)
27
- elo_rating_system!
28
- fix (~> 0.17)
29
- rake (~> 12.3)
30
-
31
- BUNDLED WITH
32
- 1.16.1
data/Rakefile DELETED
@@ -1,12 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- require 'bundler/gem_tasks'
4
- require 'rake/testtask'
5
-
6
- Rake::TestTask.new do |t|
7
- t.verbose = true
8
- t.warning = true
9
- t.pattern = File.join('fix', '**', '*_fix.rb')
10
- end
11
-
12
- task default: %i[test]
data/VERSION.semver DELETED
@@ -1 +0,0 @@
1
- 1.0.0
data/bin/console DELETED
@@ -1,15 +0,0 @@
1
- #!/usr/bin/env ruby
2
- # frozen_string_literal: true
3
-
4
- require 'bundler/setup'
5
- require 'elo_rating_system'
6
-
7
- # You can add fixtures and/or initialization code here to make experimenting
8
- # with your gem easier. You can also use a different console, if you like.
9
-
10
- # (If you use this, don't forget to add pry to your Gemfile!)
11
- # require "pry"
12
- # Pry.start
13
-
14
- require 'irb'
15
- IRB.start(__FILE__)
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
@@ -1,25 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- Gem::Specification.new do |spec|
4
- spec.name = 'elo_rating_system'
5
- spec.version = File.read('VERSION.semver').chomp
6
- spec.authors = ['Cyril Kato']
7
- spec.email = ['contact@cyril.email']
8
-
9
- spec.summary = 'Elo rating system'
10
- spec.description = 'A method for calculating the relative skill levels ' \
11
- 'of players in zero-sum games such as chess.'
12
- spec.homepage = 'https://github.com/sashite/elo_rating_system'
13
- spec.license = 'MIT'
14
-
15
- spec.files = `git ls-files -z`.split("\x0").reject do |f|
16
- f.match(%r{^(fix)/})
17
- end
18
- spec.bindir = 'exe'
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ['lib']
21
-
22
- spec.add_development_dependency 'bundler', '~> 1.16'
23
- spec.add_development_dependency 'fix', '~> 0.17'
24
- spec.add_development_dependency 'rake', '~> 12.3'
25
- end