mlang pushed a commit to branch externals/chess in repository elpa. commit e0457d8d2cc1aaacd1c723633846833c74dc3b6a Author: Mario Lang <ml...@delysid.org> Date: Sun May 25 02:33:16 2014 +0200
Make = optional when entering promotions. * chess-input.el (chess-input-test-move): Rework nested if hell as cond and make = optional in addition to x. --- chess-input.el | 18 ++++++++---------- 1 files changed, 8 insertions(+), 10 deletions(-) diff --git a/chess-input.el b/chess-input.el index e782066..46d3793 100644 --- a/chess-input.el +++ b/chess-input.el @@ -52,16 +52,14 @@ (while (and (< i l) (< x xl)) (let ((move-char (aref move i)) (entry-char (aref chess-input-move-string x))) - (if (and (= move-char ?x) - (/= entry-char ?x)) - (setq i (1+ i)) - (if (/= entry-char (if (< entry-char ?a) - move-char - (downcase move-char))) - (setq match nil i l) - (setq i (1+ i) x (1+ x))))))) - (if match - move-ply))) + (cond + ((or (and (= move-char ?x) (/= entry-char ?x)) + (and (= move-char ?=) (/= entry-char ?=))) + (setq i (1+ i))) + ((/= entry-char (if (< entry-char ?a) move-char (downcase move-char))) + (setq match nil i l)) + (t (setq i (1+ i) x (1+ x))))))) + (when match move-ply))) (defsubst chess-input-display-moves (&optional move-list) (if (> (length chess-input-move-string) 0)