From c1c33a3596492b03dbae44bf3964da71bf306f4a Mon Sep 17 00:00:00 2001 From: melvin Date: Tue, 28 Jan 2014 16:48:09 +0800 Subject: [PATCH] change input format for whr to use 0/1 to represent first/second player win instead of B/W --- exp/extract_games.awk | 4 ++-- exp/whr.rb | 8 +++++++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/exp/extract_games.awk b/exp/extract_games.awk index 99312ba1ab..51421939c5 100644 --- a/exp/extract_games.awk +++ b/exp/extract_games.awk @@ -37,9 +37,9 @@ function genName() { getline if ($8 == "0") { - C = "W" + C = "1" } else { - C = "B" + C = "0" } print ai1 "-" $3 " " ai2 "-" $6 " " C } diff --git a/exp/whr.rb b/exp/whr.rb index c445ce43fa..cf885c68cb 100755 --- a/exp/whr.rb +++ b/exp/whr.rb @@ -9,7 +9,13 @@ require 'whole_history_rating' # Handicap should generally be less than 500 elo ARGF.each do |line| tokens = line.split(' ') - @whr.create_game(tokens[0], tokens[1], tokens[2], 0, 0) + winner = + if (tokens[2] == "0") + "B" + else + "W" + end + @whr.create_game(tokens[0], tokens[1], winner, 0, 0) end # Iterate the WHR algorithm towards convergence with more players/games, more iterations are needed.