## $Id$
## Copyright (C) 2004 NABEYA Kenichi (aka nanami@2ch)
-## Copyright (C) 2007-2008 Daigo Moriwaki (daigo at debian dot org)
+## Copyright (C) 2007-2012 Daigo Moriwaki (daigo at debian dot org)
##
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published by
#
class MonitorObserver
def update(game_result)
- game_result.game.each_monitor do |monitor|
- monitor.write_safe("##[MONITOR][%s] %s\n" % [game_result.game.game_id, game_result.result_type])
+ game_result.game.each_monitor do |monitor_handler|
+ monitor_handler.write_safe(game_result.game.game_id, game_result.result_type)
end
end
end
add_observer LoggingObserver.new
if League::Floodgate.game_name?(@game.game_name) &&
- @game.sente.player_id &&
- @game.gote.player_id &&
- $options["floodgate-history"]
- add_observer League::Floodgate::History.factory
+ @game.sente.player_id && @game.gote.player_id
+ path = League::Floodgate.history_file_path(@game.game_name)
+ history = League::Floodgate::History.factory(path)
+ add_observer history if history
end
end
end
end
+class GameResultMaxMovesDraw < GameResultDraw
+ def initialize(game, winner, loser)
+ super
+ @log_summary_type = "max_moves_draw"
+ @result_type = "#MAX_MOVES_DRAW"
+ end
+
+ def process
+ @players.each do |player|
+ player.write_safe("#MAX_MOVES_DRAW\n#DRAW\n")
+ end
+ # no log
+ log_summary
+ notify
+ end
+end
+
end # ShogiServer