OSDN Git Service

Record files now include rating scores of players.
authorDaigo Moriwaki <daigo@debian.org>
Mon, 13 Oct 2014 10:15:50 +0000 (19:15 +0900)
committerDaigo Moriwaki <daigo@debian.org>
Mon, 13 Oct 2014 10:15:50 +0000 (19:15 +0900)
changelog
shogi_server/game.rb

index c8332dc..dbd47dc 100644 (file)
--- a/changelog
+++ b/changelog
@@ -4,6 +4,18 @@
          - A player, attempting to login with the current live player
            stalling for more than a day, can forcibly override the current
            player.
+         - Kifu record files now includes rating scores of players at the
+           time when games start.  Previously, for rating games, a record
+           file includes player IDs of both players with a line starting with
+           "'rating".  Now it also shows rating scores for players who have
+           valid scores.  The formats for black and white players are as
+           follows:
+             'black_rate:<player_id>:<score>
+             'white_rate:<player_id>:<score>
+           A sample output:
+             'rating:Test_sente+275876e34cf609db118f3d84b799a790:Test_gote+275876e34cf609db118f3d84b799a790
+             'black_rate:Test_sente+275876e34cf609db118f3d84b799a790:2763.0
+             'white_rate:Test_gote+275876e34cf609db118f3d84b799a790:2345.0
 
 2014-07-19  Daigo Moriwaki <daigo at debian dot org>
 
index ec9b702..50bdbaa 100644 (file)
@@ -335,6 +335,12 @@ class Game
       black_name = @sente.rated? ? @sente.player_id : @sente.name
       white_name = @gote.rated?  ? @gote.player_id  : @gote.name
       @fh.puts("'rating:%s:%s" % [black_name, white_name])
+      if @sente.rated? && @sente.rate != 0
+        @fh.puts("'black_rate:%s:%s" % [@sente.player_id, @sente.rate])
+      end
+      if @gote.rated? && @gote.rate != 0
+        @fh.puts("'white_rate:%s:%s" % [@gote.player_id, @gote.rate])
+      end
     end
     unless @board.initial_moves.empty?
       @fh.puts "'buoy game starting with %d moves" % [@board.initial_moves.size]