diff options
| author | Mario Lang <mlang@delysid.org> | 2014-04-21 19:25:16 +0200 |
|---|---|---|
| committer | Mario Lang <mlang@delysid.org> | 2014-04-21 19:25:16 +0200 |
| commit | a442c47f713298e3174cd7488cac2e02d76d289c (patch) | |
| tree | 1dbe5d84675a9cf16da7eb82f6a6f6d420b74b0d | |
| parent | e9823070847892ed90aa9e9ce9d252b104872b0a (diff) | |
chess-legal-plies: Simplify the :color case.
| -rw-r--r-- | chess-ply.el | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/chess-ply.el b/chess-ply.el index 7e35046..7fe420f 100644 --- a/chess-ply.el +++ b/chess-ply.el @@ -342,14 +342,13 @@ position object passed in." (catch 'any-found (apply 'chess-legal-plies position (delq :any keywords))))) ((memq :color keywords) - (let* ((plies (list t)) - (color (cadr (memq :color keywords))) - (pieces (if color '(?P ?N ?B ?R ?Q ?K) '(?p ?n ?b ?r ?q ?k))) - (candidates (apply #'chess-pos-search* position pieces))) - (dolist (p pieces) - (nconc plies (chess-legal-plies position - :piece p - :candidates (cdr (assq p candidates))))) + (let ((plies (list t))) + (dolist (p (apply #'chess-pos-search* position (if (cadr (memq :color keywords)) + '(?P ?N ?B ?R ?Q ?K) + '(?p ?n ?b ?r ?q ?k)))) + (when (cdr p) + (nconc plies (chess-legal-plies position + :piece (car p) :candidates (cdr p))))) (cdr plies))) (t (let* ((piece (cadr (memq :piece keywords))) |
