summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chess-algebraic.el3
-rw-r--r--chess-ply.el7
-rw-r--r--chess-pos.el4
3 files changed, 8 insertions, 6 deletions
diff --git a/chess-algebraic.el b/chess-algebraic.el
index 737a4d0..b7038cd 100644
--- a/chess-algebraic.el
+++ b/chess-algebraic.el
@@ -152,7 +152,8 @@ If LONG is non-nil, render the move into long notation."
(chess-index-to-coord to)
(let ((promote (memq :promote changes)))
(if promote
- (concat "=" (char-to-string (cadr promote))))))))))
+ (concat "=" (char-to-string
+ (upcase (cadr promote)))))))))))
(concat notation
(if (memq :check changes) "+"
(if (memq :checkmate changes) "#"))))))
diff --git a/chess-ply.el b/chess-ply.el
index d70c455..57c2451 100644
--- a/chess-ply.el
+++ b/chess-ply.el
@@ -140,7 +140,8 @@ maneuver."
;; is this a pawn move to the ultimate rank? if so, and we
;; haven't already been told, ask for the piece to promote
- ;; it to
+ ;; it to; NOTE: 'color' has the inverse meaning at this
+ ;; point...
(unless (memq :promote changes)
(if (and (= ?p (downcase (chess-pos-piece next-pos
(cadr changes))))
@@ -151,8 +152,8 @@ maneuver."
chess-piece-name-table nil t "queen")))
(setq new-piece
(cdr (assoc new-piece chess-piece-name-table)))
- (if color
- (setq new-piece (upcase new-piece)))
+ (unless color
+ (setq new-piece (upcase new-piece)))
(nconc changes (list :promote new-piece))))))
;; return the annotated ply
diff --git a/chess-pos.el b/chess-pos.el
index 286047e..915e5b9 100644
--- a/chess-pos.el
+++ b/chess-pos.el
@@ -254,7 +254,7 @@ trying to move a blank square."
;; if a king or rook moves, no more castling; also, if a pawn
;; jumps ahead two, mark it en-passantable
- (let ((piece (downcase (chess-pos-piece position (car changes)))))
+ (let ((piece (downcase (chess-pos-piece position (cadr changes)))))
(cond
((and (= piece ?k)
(equal (car changes)
@@ -281,7 +281,7 @@ trying to move a blank square."
(chess-pos-set-side-to-move position (not color))
;; promote the piece if we were meant to
- (let ((new-piece (cadr (assq :promote changes))))
+ (let ((new-piece (cadr (memq :promote changes))))
(if new-piece
(chess-pos-set-piece position (cadr changes) new-piece)))