summaryrefslogtreecommitdiff
path: root/chess-pos.el
diff options
context:
space:
mode:
authorMario Lang <mlang@delysid.org>2014-04-19 21:00:26 +0200
committerMario Lang <mlang@delysid.org>2014-04-19 21:00:26 +0200
commit6cd4c9823a851c39408e1e8d747bdf17c16e57b7 (patch)
tree08e362291075604a18e794de4d976927ce708193 /chess-pos.el
parentb02e69725f86761057dc133aa90388432ea3b72b (diff)
chess-knight-directions: New constant.
Diffstat (limited to 'chess-pos.el')
-rw-r--r--chess-pos.el15
1 files changed, 11 insertions, 4 deletions
diff --git a/chess-pos.el b/chess-pos.el
index 98d107a..84fdecb 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -376,6 +376,16 @@ in order to execute faster."
chess-direction-southeast)
"The directions a bishop is allowed to move to.")
+(defconst chess-knight-directions (list chess-direction-north-northeast
+ chess-direction-east-northeast
+ chess-direction-east-southeast
+ chess-direction-south-southeast
+ chess-direction-south-southwest
+ chess-direction-west-southwest
+ chess-direction-west-northwest
+ chess-direction-north-northwest)
+ "The directions a knight is allowed to move to.")
+
(defconst chess-queen-directions (list chess-direction-northwest
chess-direction-north
chess-direction-northeast
@@ -918,10 +928,7 @@ If NO-CASTLING is non-nil, do not consider castling moves."
;; the knight is a zesty little piece; there may be more than
;; one, but at only one possible square in each direction
((= test-piece ?N)
- (dolist (dir (list chess-direction-north-northeast chess-direction-east-northeast
- chess-direction-east-southeast chess-direction-south-southeast
- chess-direction-south-southwest chess-direction-west-southwest
- chess-direction-west-northwest chess-direction-north-northwest))
+ (dolist (dir chess-knight-directions)
;; up the current file
(if (and (setq pos (chess-next-index target dir))
(chess-pos-piece-p position pos piece))