OSDN Git Service

New feature: max moves
[shogi-server/shogi-server.git] / shogi-server
index c0f64f8..a20c410 100755 (executable)
@@ -1,4 +1,4 @@
-#! /usr/bin/ruby1.9.1
+#! /usr/bin/ruby
 # $Id$
 #
 # Author:: NABEYA Kenichi, Daigo Moriwaki
 # $Id$
 #
 # Author:: NABEYA Kenichi, Daigo Moriwaki
@@ -76,6 +76,9 @@ OPTIONS
         port_number
                 a port number for the server to listen. 
                 4081 is often used.
         port_number
                 a port number for the server to listen. 
                 4081 is often used.
+        --max-moves n
+                when a game with the n-th move played does not end, make the game a draw.
+                Default 256. 0 disables this feature.
         --pid-file file
                 a file path in which a process ID will be written.
                 Use with --daemon option.
         --pid-file file
                 a file path in which a process ID will be written.
                 Use with --daemon option.
@@ -138,6 +141,20 @@ FLOODGATE SCHEDULE CONFIGURATIONS
                Sat 22:00
                Sun 13:00
 
                Sat 22:00
                Sun 13:00
 
+            PAREMETER SETTING
+
+            In addition, this configuration file allows to set parameters
+            for the specific Floodaget group. A list of parameters is the
+            following:
+
+            * pairing_factory:
+              Specifies a factory function name generating a pairing
+              method which will be used in a specific Floodgate game.
+              ex. set pairing_factory floodgate_zyunisen
+            * sacrifice:
+              Specifies a sacrificed player.
+              ex. set sacrifice gps500+e293220e3f8a3e59f79f6b0efffaa931
+
 LICENSE
         GPL versoin 2 or later
 
 LICENSE
         GPL versoin 2 or later
 
@@ -179,6 +196,7 @@ def parse_command_line
   parser = GetoptLong.new(
     ["--daemon",            GetoptLong::REQUIRED_ARGUMENT],
     ["--floodgate-games",   GetoptLong::REQUIRED_ARGUMENT],
   parser = GetoptLong.new(
     ["--daemon",            GetoptLong::REQUIRED_ARGUMENT],
     ["--floodgate-games",   GetoptLong::REQUIRED_ARGUMENT],
+    ["--max-moves",         GetoptLong::REQUIRED_ARGUMENT],
     ["--pid-file",          GetoptLong::REQUIRED_ARGUMENT],
     ["--player-log-dir",    GetoptLong::REQUIRED_ARGUMENT])
   parser.quiet = true
     ["--pid-file",          GetoptLong::REQUIRED_ARGUMENT],
     ["--player-log-dir",    GetoptLong::REQUIRED_ARGUMENT])
   parser.quiet = true
@@ -249,6 +267,9 @@ def check_command_line
     $stderr.puts "WARNING: --floodgate-history has been deprecated."
     $options["floodgate-history"] = nil
   end
     $stderr.puts "WARNING: --floodgate-history has been deprecated."
     $options["floodgate-history"] = nil
   end
+
+  $options["max-moves"] ||= 256
+  $options["max-moves"] = $options["max-moves"].to_i
 end
 
 # See if a file can be created in the directory.
 end
 
 # See if a file can be created in the directory.
@@ -372,6 +393,7 @@ def main
   $league.dir = $topdir
 
   config = {}
   $league.dir = $topdir
 
   config = {}
+  config[:BindAddress] = "0.0.0.0"
   config[:Port]       = port
   config[:ServerType] = WEBrick::Daemon if $options["daemon"]
   config[:Logger]     = $logger
   config[:Port]       = port
   config[:ServerType] = WEBrick::Daemon if $options["daemon"]
   config[:Logger]     = $logger