OSDN Git Service

Debugged Floodgate
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 6 Oct 2008 03:51:36 +0000 (03:51 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 6 Oct 2008 03:51:36 +0000 (03:51 +0000)
shogi_server/league/floodgate.rb
shogi_server/pairing.rb

index d7df4e6..317dfe1 100644 (file)
@@ -41,7 +41,7 @@ class League
         Floodgate.game_name?(pl.game_name) &&
         pl.sente == nil
       end
-      Pairing.default_pairing.match(players)
+      Pairing.match(players)
     end
   end # class Floodgate
 
index 01f4fe0..992dbcb 100644 (file)
@@ -29,14 +29,16 @@ module ShogiServer
       end
 
       def sort_by_rate_with_randomness
-        return [ExcludeSacrificeGps500.new,
+        return [LogPlayers.new,
+                ExcludeSacrificeGps500.new,
                 MakeEven.new,
                 SortByRateWithRandomness.new(1200, 2400),
                 StartGame.new]
       end
 
       def random_pairing
-        return [ExcludeSacrificeGps500.new,
+        return [LogPlayers.new,
+                ExcludeSacrificeGps500.new,
                 MakeEven.new,
                 Randomize.new,
                 StartGame.new]
@@ -46,6 +48,7 @@ module ShogiServer
         logics = default_factory
         logics.inject(players) do |result, item|
           item.match(result)
+          result
         end
       end
     end # class << self
@@ -84,6 +87,13 @@ module ShogiServer
     end
   end # Pairing
 
+
+  class LogPlayers < Pairing
+    def match(players)
+      log_players(players)
+    end
+  end
+
   class StartGame < Pairing
     def match(players)
       super
@@ -104,7 +114,7 @@ module ShogiServer
       end
     end
 
-    def start_game
+    def start_game(p1, p2)
       log_message("Floodgate: BLACK %s; WHITE %s" % [p1.name, p2.name])
       p1.sente = true
       p2.sente = false