diff options
| -rw-r--r-- | chess-pos.el | 15 |
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)) |
