OSDN Git Service

Sente (gote) was able to move gote's (sente's) hand. That move should be illegal...
authorbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 26 Nov 2006 10:53:07 +0000 (10:53 +0000)
committerbeatles <beatles@b8c68f68-1e22-0410-b08e-880e1f8202b4>
Sun, 26 Nov 2006 10:53:07 +0000 (10:53 +0000)
changelog
shogi-server

index a3542e2..23ba547 100644 (file)
--- a/changelog
+++ b/changelog
@@ -1,3 +1,8 @@
+2006-11-26  Daigo Moriwaki <daigo at debian dot org>
+
+       * [shogi-server] Sente (gote) was able to move gote's (sente's) hand.
+         That move should be illegal. This issue has been fixed.
+
 2006-11-01  Daigo Moriwaki <daigo at debian dot org>
 
        * [mk_rate] Skip "abnormal" games, which were finished because of
index 906fe10..eeef0f1 100755 (executable)
@@ -1271,7 +1271,7 @@ class Board
     return true
   end
 
-  def handle_one_move(str, sente=nil)
+  def handle_one_move(str, sente)
     if (str =~ /^([\+\-])(\d)(\d)(\d)(\d)([A-Z]{2})/)
       sg = $1
       x0 = $2.to_i
@@ -1300,10 +1300,10 @@ class Board
     end
     
     if (sg == "+")
-      sente = true
+      return :illegal unless sente == true   # black player's move must be black
       hands = @sente_hands
     else
-      sente = false
+      return :illegal unless sente == false  # white player's move must be white
       hands = @gote_hands
     end