OSDN Git Service

added an extension implemented by daigo moriwaki.
authortkaneko <tkaneko@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 6 Mar 2006 10:19:24 +0000 (10:19 +0000)
committertkaneko <tkaneko@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Mon, 6 Mar 2006 10:19:24 +0000 (10:19 +0000)
A server now acceps a move with a comment (e.g., "+7776FU,'joseki"), and then will write the comment in the next line of the move in the game record (e.g., "+7776FU\n'* joseki\n").

shogi-server

index cc3dd74..fe50dfe 100755 (executable)
@@ -232,7 +232,19 @@ class Player
         end
         str.chomp! if (str.class == String)
         case str
-        when /^[\+\-%][^%]/, :timeout
+        when /^[\+\-][^%]/
+          if (@status == "game")
+            array_str = str.split(",")
+            move = array_str.shift
+            additional = array_str.shift
+            if /^'(.*)/ =~ additional
+              comment = array_str.unshift("'* #{$1}")
+            end
+            s = @game.handle_one_move(move, self)
+            @game.fh.print("#{comment}\n") if comment
+            return if (s && @protocol == "CSA")
+          end
+        when /^%[^%]/, :timeout
           if (@status == "game")
             s = @game.handle_one_move(str, self)
             return if (s && @protocol == "CSA")