lib/icu_ratings/tournament.rb in icu_ratings-0.2.7 vs lib/icu_ratings/tournament.rb in icu_ratings-0.3.0
- old
+ new
@@ -68,9 +68,10 @@
# Add a new player to the tournament. Returns the instance of ICU::RatedPlayer created.
# See ICU::RatedPlayer for details.
def add_player(num, args={})
raise "player with number #{num} already exists" if @player[num]
+ args[:kfactor] = ICU::RatedPlayer.kfactor(args[:kfactor].merge({ :start => start, :rating => args[:rating] })) if args[:kfactor].is_a?(Hash)
@player[num] = ICU::RatedPlayer.new(num, args)
end
# Add a new result to the tournament. Two instances of ICU::RatedResult are
# created. One is added to the first player and the other to the second player.