SHARE
TWEET

Untitled

a guest Nov 8th, 2017 138 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. require 'C:\Users\caffeine\Desktop\ctwc\whole_history_rating'
  2.  
  3. @whr = WholeHistoryRating::Base.new
  4.  
  5. # WholeHistoryRating::Base#create_game arguments: black player name, white player name, winner, day number, handicap
  6. # Handicap should generally be less than 500 elo
  7.  
  8. days = 0
  9. File.open("C:\\Users\\caffeine\\Desktop\\ctwc\\history.txt", "r") do |f|
  10.   f.each_line do |line|
  11.     if line.start_with?("CTWC")
  12.       days += 365
  13.     end
  14.     if line.include?("vs")
  15.       words = line.split(' ')
  16.       results = words[3].split("")
  17.       results.each do |r|
  18.         if r == "W"
  19.           @whr.create_game(words[0], words[2], "B", days, 0)
  20.         elsif r == "L"
  21.           @whr.create_game(words[0], words[2], "W", days, 0)
  22.         end
  23.       end
  24.     end
  25.     end
  26. end
  27.  
  28. @whr.iterate(10000)
  29. @whr.print_ordered_ratings()
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top