change input format for whr to use 0/1 to represent first/second player win instead of B/W

master
melvin 2014-01-28 16:48:09 +08:00
parent 3fd39e0a8c
commit c1c33a3596
2 changed files with 9 additions and 3 deletions

View File

@ -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
}

View File

@ -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.