[Tkabber-dev] r1485 - in trunk/tkabber-plugins: . chess

tkabber-svn at jabber.ru tkabber-svn at jabber.ru
Fri Aug 8 19:47:18 MSD 2008


Author: sergei
Date: 2008-08-08 19:47:17 +0400 (Fri, 08 Aug 2008)
New Revision: 1485

Modified:
   trunk/tkabber-plugins/ChangeLog
   trunk/tkabber-plugins/chess/chess.tcl
Log:
	* chess/chess.tcl: Added possibility of castling and capture en passant
	  to position code when counting repetitions.


Modified: trunk/tkabber-plugins/ChangeLog
===================================================================
--- trunk/tkabber-plugins/ChangeLog	2008-08-08 15:21:34 UTC (rev 1484)
+++ trunk/tkabber-plugins/ChangeLog	2008-08-08 15:47:17 UTC (rev 1485)
@@ -11,6 +11,9 @@
 	* chess/chess.tcl: Fixed bug with forbidden castling in case when
 	  pieces has moved.
 
+	* chess/chess.tcl: Added possibility of castling and capture en passant
+	  to position code when counting repetitions.
+
 2008-07-12  Sergei Golovan <sgolovan at nes.ru>
 
 	* whiteboard/whiteboard.tcl: Fixed typo.

Modified: trunk/tkabber-plugins/chess/chess.tcl
===================================================================
--- trunk/tkabber-plugins/chess/chess.tcl	2008-08-08 15:21:34 UTC (rev 1484)
+++ trunk/tkabber-plugins/chess/chess.tcl	2008-08-08 15:47:17 UTC (rev 1485)
@@ -342,6 +342,27 @@
 	    }
 	}
     }
+
+    append code $flags(position,wk,kcastling)
+    append code $flags(position,wk,qcastling)
+    append code $flags(position,bk,kcastling)
+    append code $flags(position,bk,qcastling)
+
+    if {[llength $flags(position,enpassant)] > 0} {
+	lassign $flags(position,enpassant) c r
+	set cp1 [expr {$c + 1}]
+	set cm1 [expr {$c - 1}]
+	if {$r == 2} {
+	    if {$flags(position,$cp1,3) == "bp" || $flags(position,$cm1,3) == "bp"} {
+		append code $c$r
+	    }
+	} elseif {$r == 5} {
+	    if {$flags(position,$cp1,4) == "wp" || $flags(position,$cm1,4) == "wp"} {
+		append code $c$r
+	    }
+	}
+    }
+
     return $code
 }
 



More information about the Tkabber-dev mailing list